/* Plainwire 2.0.0 workspace */
@charset "UTF-8";
/* Plainwire workspace source */
:root,
[data-theme=light] {
  --bg: #f6f7f9;
  --bg2: #ffffff;
  --bg3: #eef0f3;
  --bg4: #e4e7eb;
  --hover: #eceff3;
  --active: #e1e5ea;
  --text: #2d3138;
  --text1: #15181d;
  --text2: #5d6673;
  --muted: #77808d;
  --accent: #5267d7;
  --accent2: #4458bc;
  --danger: #c94148;
  --ok: #2d8653;
  --line: #dde1e6;
  --line2: #cfd5dc;
  --radius: 4px;
  --radius-lg: 8px;
  --shadow: 0 8px 28px rgba(0,0,0,.1);
  --header-h: 48px;
  --rail-w: 72px;
  --side-w: 240px;
  --right-w: 240px;
  --ui-font-scale: 1;
}

[data-theme=dark] {
  --bg: #17191d;
  --bg2: #1d2025;
  --bg3: #121418;
  --bg4: #0d0f12;
  --hover: #252930;
  --active: #2d323a;
  --text: #d9dde4;
  --text1: #f3f5f7;
  --text2: #aeb5bf;
  --muted: #89919d;
  --danger: #e05259;
  --ok: #36a269;
  --line: #2c3138;
  --line2: #242930;
  --shadow: 0 12px 34px rgba(0,0,0,.42);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=dark]):not([data-theme=light]) {
    --bg: #17191d;
    --bg2: #1d2025;
    --bg3: #121418;
    --bg4: #0d0f12;
    --hover: #252930;
    --active: #2d323a;
    --text: #d9dde4;
    --text1: #f3f5f7;
    --text2: #aeb5bf;
    --muted: #89919d;
    --danger: #e05259;
    --ok: #36a269;
    --line: #2c3138;
    --line2: #242930;
    --shadow: 0 12px 34px rgba(0,0,0,.42);
  }
}
[data-font-scale=small] {
  --ui-font-scale: .92;
}

[data-font-scale=large] {
  --ui-font-scale: 1.08;
}

[data-corner-style=rounded] {
  --radius: 8px;
  --radius-lg: 12px;
}

[data-corner-style=compact] {
  --radius: 2px;
  --radius-lg: 5px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg3);
  color: var(--text);
  font: calc(16px * var(--ui-font-scale))/1.45 "gg sans", "Noto Sans", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

button, a {
  touch-action: manipulation;
}

#app {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.boot {
  display: grid;
  place-items: center;
  height: 100vh;
  color: var(--muted);
}

.layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: var(--bg4);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 6px;
  overflow-y: auto;
}

.mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--accent);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-radius 0.15s;
}
.mark:hover {
  border-radius: 12px;
}

.rail-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  transition: background 0.12s, border-radius 0.12s, color 0.12s;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.rail-btn:hover {
  background: var(--accent);
  color: #fff;
  border-radius: 14px;
}
.rail-btn.active {
  background: var(--accent);
  color: #fff;
  border-radius: 14px;
}
.rail-btn::before {
  content: "";
  position: absolute;
  left: -10px;
  width: 4px;
  height: 0;
  background: #fff;
  border-radius: 0 4px 4px 0;
  transition: height 0.12s;
}
.rail-btn.active::before, .rail-btn:hover::before {
  height: 20px;
}
.rail-btn .server-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 18px;
  transition: border-radius 0.15s;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.rail-btn .server-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.rail-spacer {
  flex: 1;
}

.side {
  width: var(--side-w);
  flex-shrink: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}

.side-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.side-head h1 {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-head small {
  color: var(--muted);
  font-size: 13px;
}

.nav-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg3);
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: var(--header-h);
  border-bottom: 1px solid var(--line);
  background: var(--bg3);
  flex-shrink: 0;
}
.topbar h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.topbar .mobile-back {
  display: none;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scroll-padding-bottom: 140px;
}

.chat-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.chat-content > .chat-surface, .chat-content > .chat-with-members {
  flex: 1;
  min-height: 0;
}
.chat-content > .chat-surface {
  height: 100%;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background 0.1s;
}
.row:hover, .row.active {
  background: var(--hover);
}
.row .grow {
  flex: 1;
  min-width: 0;
}
.row b {
  display: block;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row small {
  color: var(--muted);
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-row {
  align-items: center;
  min-height: 58px;
  position: relative;
  padding-top: 10px;
  padding-bottom: 10px;
}
.dm-row .avatar {
  width: 40px;
  height: 40px;
}
.dm-row .badge {
  margin-left: auto;
  flex-shrink: 0;
}
.dm-row.unread {
  background: rgba(88, 101, 242, 0.08);
}
.dm-row.unread b {
  color: var(--text1);
  font-weight: 700;
}
.dm-row.unread .dm-preview {
  color: var(--text2);
}
.dm-row.active {
  background: var(--active);
  box-shadow: inset 3px 0 0 var(--accent);
}

.dm-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.dm-row-head b {
  min-width: 0;
}
.dm-row-head small {
  flex-shrink: 0;
  font-size: 11px;
}

.dm-preview {
  max-width: 100%;
}

.group-avatar {
  background: var(--accent);
  color: #fff;
}

.dm-inbox {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dm-list-card {
  padding: 6px;
}

.dm-empty {
  padding: 42px 16px;
}
.dm-empty h2 {
  margin: 0 0 6px;
  color: var(--text1);
  font-style: normal;
}
.dm-empty p {
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  min-height: 36px;
  transition: background 0.12s;
  white-space: nowrap;
}
.btn:hover {
  background: var(--accent2);
}
.btn:active {
  transform: scale(0.98);
}
.btn.secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.secondary:hover {
  background: var(--hover);
  border-color: var(--text2);
}
.btn.danger {
  background: var(--danger);
}
.btn.danger:hover {
  background: #c72f34;
}
.btn.ghost {
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}
.card.pad, .card .pad {
  padding: 16px;
}

.home-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  padding: 24px;
  border: 1px solid rgba(88, 101, 242, 0.35);
  border-radius: 18px;
  background: var(--bg2);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}
.hero-card h1 {
  margin: 6px 0 8px;
  max-width: 760px;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}
.hero-card p {
  margin: 0;
  color: var(--text2);
  max-width: 680px;
}

.eyebrow {
  color: #b9c0ff;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg2);
  color: var(--text);
  padding: 16px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}
.stat-card:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 101, 242, 0.55);
  background: var(--hover);
}
.stat-card b, .stat-card small {
  display: block;
}
.stat-card small {
  color: var(--muted);
}

.stat-value {
  display: block;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  color: var(--text1);
  margin-bottom: 8px;
}

.home-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 {
  margin: 0;
}
.section-head p {
  margin: 4px 0 0;
}

.check-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text2);
}
.check-list li {
  margin: 8px 0;
}

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

.forum-header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.forum-header-bar .forum-header-title h2 {
  margin: 0 0 4px;
}
.forum-header-bar .forum-header-title p {
  margin: 0;
}
.forum-header-bar .forum-header-actions {
  flex-shrink: 0;
}

.forum-search {
  position: relative;
}
.forum-search .forum-search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.forum-search .forum-search-input:focus {
  border-color: var(--accent);
}
.forum-search .forum-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
}

.forum-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 16px 0 8px;
}

.forum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}

.forum-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.forum-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.forum-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 8px;
  cursor: pointer;
}

.forum-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.forum-card-icon.large {
  width: 52px;
  height: 52px;
  font-size: 18px;
  border-radius: 14px;
}

.forum-card-info {
  flex: 1;
  min-width: 0;
}

.forum-card-name {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text1);
}

.forum-card-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-card-stats {
  display: flex;
  gap: 12px;
  padding: 4px 14px 8px;
}
.forum-card-stats .forum-stat {
  font-size: 12px;
  color: var(--muted);
  position: relative;
}
.forum-card-stats .forum-stat + .forum-stat::before {
  content: "·";
  margin-right: 12px;
  color: var(--line);
}

.forum-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg3);
}

.forum-card-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.forum-card-link:hover {
  text-decoration: underline;
}

.forum-join-btn {
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 16px;
  border-radius: 20px;
}
.forum-join-btn:hover {
  background: var(--accent2);
}

.forum-joined-btn {
  background: var(--bg);
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
}
.forum-joined-btn:hover {
  background: var(--hover);
  border-color: var(--danger);
  color: var(--danger);
}

.forum-view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  flex-wrap: wrap;
}
.forum-view-header .forum-view-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.forum-view-header .forum-view-title h2 {
  margin: 0 0 4px;
}
.forum-view-header .forum-view-title p {
  margin: 0;
  font-size: 13px;
}
.forum-view-header .forum-view-stats {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.forum-view-header .forum-view-actions {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.forum-stat {
  font-size: 12px;
  color: var(--muted);
  position: relative;
}
.forum-stat + .forum-stat::before {
  content: "·";
  margin-right: 10px;
  color: var(--line);
}

.thread-delete-btn {
  margin-left: auto;
  padding: 3px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
}
.thread-delete-btn:hover, .thread-delete-btn:focus-visible {
  background: rgba(218, 55, 60, 0.12);
}

.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.field input, .field textarea, .field select, .field .search input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s;
}
.field input:focus, .field textarea:focus, .field select:focus, .field .search input:focus {
  border-color: var(--accent);
}

.search {
  padding: 0 12px 12px;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--hover);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--text);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.avatar.tiny {
  width: 22px;
  height: 22px;
  font-size: 10px;
}
.avatar.big {
  width: 80px;
  height: 80px;
  font-size: 28px;
}

.server-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
  object-fit: cover;
  line-height: 1;
  color: var(--muted);
  transition: border-radius 0.12s;
}
.server-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 18px;
  display: flex;
  flex-direction: column;
}
.messages .empty {
  padding: 40px 0;
}

.chat-surface {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-h) - 32px);
  border: 1px solid rgba(255, 255, 255, 0.035);
  border-radius: 18px;
  overflow: hidden;
  background: var(--bg2);
}

.chat-status {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -16px -16px 10px;
  padding: 10px 16px;
  background: rgba(30, 31, 34, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-size: 13px;
}

.chat-header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 13px 18px;
  background: rgba(17, 18, 20, 0.62);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.chat-header .avatar {
  width: 42px;
  height: 42px;
}
.chat-header .grow {
  flex: 1;
  min-width: 0;
}
.chat-header h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-header small {
  display: block;
  margin-top: 2px;
}
.chat-header .btn {
  min-height: 34px;
  padding: 0 12px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(35, 165, 90, 0.13);
}

.chat-empty {
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
}

.msg {
  content-visibility: auto;
  contain-intrinsic-block-size: auto 64px;
  display: flex;
  gap: 12px;
  padding: 6px 12px 6px 14px;
  margin: 0 -8px;
  border-radius: 10px;
  transition: background 0.1s, box-shadow 0.1s, color 0.1s;
  position: relative;
}
.msg:hover {
  background: rgba(88, 101, 242, 0.075);
  box-shadow: inset 2px 0 0 rgba(140, 149, 255, 0.28);
}
.msg.compact {
  padding-top: 0;
  padding-bottom: 1px;
  margin-top: -1px;
  border-radius: 4px;
}
.msg.compact .avatar-spacer {
  visibility: hidden;
}
.msg.compact .msg-main {
  display: block;
}
.msg.compact .msg-body {
  margin: 0;
}
.msg.highlighted {
  animation: highlight-flash 2s ease;
  border-radius: 4px;
}
.msg.mine {
  background: transparent;
}
.msg.mine:hover {
  background: rgba(88, 101, 242, 0.085);
}
.msg.pending {
  opacity: 0.72;
}

.message-history-sentinel {
  min-height: 1px;
  padding: 4px 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.chat-with-members {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 12px;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}
.chat-with-members .chat-surface {
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.group-members {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg2);
  overflow: hidden;
  min-height: 0;
}

.group-members-head {
  padding: 18px 16px 13px;
  border-bottom: 1px solid var(--line);
}
.group-members-head h3 {
  margin: 4px 0 0;
  font-size: 15px;
}

.group-members-list {
  padding: 8px;
  max-height: calc(100% - 70px);
  overflow-y: auto;
}

.group-members-loading {
  padding: 18px 10px;
  text-align: center;
}

.group-member {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.group-member:hover, .group-member:focus-visible {
  background: var(--hover);
  outline: none;
}

.group-member-avatar {
  position: relative;
  flex: 0 0 auto;
}

.member-presence {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border: 3px solid var(--bg2);
  border-radius: 50%;
  background: var(--muted);
}
.member-presence.online {
  background: var(--ok);
}

.group-member-copy {
  min-width: 0;
  flex: 1;
}
.group-member-copy b, .group-member-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-owner {
  font-size: 9px;
}

.friend-not-found {
  border-color: rgba(237, 66, 69, 0.35);
  background: rgba(237, 66, 69, 0.06);
}

@media (max-width: 900px) {
  .chat-with-members {
    grid-template-columns: minmax(0, 1fr);
  }
  .group-members {
    order: -1;
    border-radius: 12px;
  }
  .group-members-head {
    padding: 10px 12px;
  }
  .group-members-list {
    display: flex;
    overflow-x: auto;
  }
  .group-member {
    width: 190px;
    flex: 0 0 190px;
  }
}
.msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.msg-name {
  font-weight: 700;
  cursor: pointer;
  color: var(--text1);
}
.msg-name:hover {
  text-decoration: underline;
}

.msg-time {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 400;
  padding: 0;
  cursor: pointer;
}
.msg-time:hover {
  color: var(--text2);
  text-decoration: underline;
}

.compact-time {
  position: absolute;
  left: 8px;
  top: 2px;
  width: 42px;
  opacity: 0;
  text-align: right;
  padding-right: 6px;
  font-size: 10px;
  transition: opacity 0.1s;
}
.msg:hover .compact-time {
  opacity: 0.9;
}

.msg-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.42;
  color: #d6d9df;
}
.msg-body a {
  color: var(--accent);
  text-decoration: underline;
}
.msg-body a:hover {
  color: #7b9cff;
}

.msg-actions {
  position: absolute;
  right: 8px;
  top: -8px;
  display: none;
  gap: 0;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 2;
  overflow: hidden;
}
.msg:hover .msg-actions {
  display: flex;
}
.msg.compact .msg-actions {
  top: 0;
}

.msg-action {
  background: transparent;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text2);
  transition: background 0.1s;
}
.msg-action:hover {
  background: var(--hover);
  color: var(--text1);
}
.msg-action.danger:hover {
  background: rgba(218, 55, 60, 0.18);
  color: #ffb4b8;
}

.self-pill {
  font-size: 10px;
  padding: 1px 5px;
  background: rgba(88, 101, 242, 0.14);
  border-color: rgba(88, 101, 242, 0.25);
  color: #b9c0ff;
}

.embed {
  margin-top: 6px;
  max-width: 420px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg);
}
.embed img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  display: block;
}

.embed-body {
  padding: 10px 12px;
}

.embed-site {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}

.embed-title {
  font-weight: 600;
  margin: 4px 0;
}

.embed-desc {
  color: var(--muted);
  font-size: 13px;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 18px 18px;
  flex-shrink: 0;
}
.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(17, 18, 20, 0.72);
  color: var(--text);
  resize: vertical;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025), 0 12px 40px rgba(0, 0, 0, 0.16);
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.composer textarea:focus {
  border-color: rgba(88, 101, 242, 0.65);
  background: rgba(17, 18, 20, 0.9);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.14);
}
.composer .btn {
  align-self: flex-end;
  height: 44px;
  padding: 0 16px;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.composer-footer .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.attach-btn {
  white-space: nowrap;
}

.message-image-link {
  display: block;
  margin-top: 0.45rem;
  width: fit-content;
  max-width: min(100%, 720px);
}

.message-image {
  display: block;
  max-width: 100%;
  max-height: 520px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.18);
}

.message-file {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.4rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}

.message-file:hover {
  border-color: var(--accent);
}

.message-file-icon {
  font-size: 1.15rem;
  color: var(--accent);
}

.modal-composer-footer {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}

.message-link {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.profile .banner {
  height: 120px;
  background: var(--bg);
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.profile-body {
  display: flex;
  gap: 16px;
  padding: 16px;
  align-items: flex-start;
}
.profile-body .avatar.big {
  margin-top: -36px;
  border: 4px solid var(--bg2);
}

.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  margin-right: 4px;
}

.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
}
.badge:empty, .badge[data-zero="1"] {
  display: none;
}

.muted {
  color: var(--muted);
}

.empty {
  padding: 20px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
  font-size: 14px;
}

.post {
  margin-bottom: 12px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.thread-title {
  margin-top: 0;
}

.notif.unseen {
  background: rgba(88, 101, 242, 0.08);
}

.right {
  width: var(--right-w);
  flex-shrink: 0;
  background: var(--bg);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.members-panel h3 {
  margin: 0;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.member-group {
  padding: 6px 8px;
}

.member-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  padding: 6px 8px;
}

.voice {
  padding: 12px;
  border-top: 1px solid var(--line);
}

.voice-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.voice-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}
.status-dot.offline {
  background: var(--muted);
}
.status-dot.away {
  background: #f0ad4e;
}
.status-dot.busy {
  background: #e74c3c;
}
.status-dot.invisible {
  background: var(--muted);
}

.presence-avatar {
  position: relative;
  display: inline-grid;
  width: max-content;
  height: max-content;
  align-self: flex-start;
  flex: 0 0 auto;
  line-height: 1;
}
.presence-avatar .avatar {
  margin: 0;
}
.presence-avatar img.avatar {
  display: block;
}
.presence-avatar div.avatar {
  display: grid;
  place-items: center;
}

.avatar-presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 13px;
  height: 13px;
  border: 3px solid var(--bg3);
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}
.avatar-presence-dot.online {
  background: var(--ok);
}
.avatar-presence-dot.away {
  background: #f0ad4e;
}
.avatar-presence-dot.busy {
  background: #e74c3c;
}
.avatar-presence-dot.offline, .avatar-presence-dot.invisible {
  background: var(--muted);
}

.presence-avatar:has(.avatar.big) .avatar-presence-dot {
  width: 20px;
  height: 20px;
  border-width: 4px;
  right: 1px;
  bottom: 1px;
}

.group-members .avatar-presence-dot,
.members-panel .avatar-presence-dot,
.dm-list-card .avatar-presence-dot {
  border-color: var(--bg2);
}

.invite-card {
  max-width: 480px;
  margin: 6vh auto;
  text-align: center;
}
.invite-card .server-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  font-size: 28px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.modal-card {
  width: min(480px, 100%);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}

.action-modal {
  width: min(560px, 100vw - 28px);
  border-radius: 18px;
  background: #24262b;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(88, 101, 242, 0.12);
}

.invite-code-box {
  display: flex;
  gap: 8px;
}
.invite-code-box .invite-code-input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--text);
  font-family: monospace;
  font-size: 14px;
  outline: none;
}
.invite-code-box .btn {
  flex-shrink: 0;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.modal-head p {
  margin: 4px 0 0;
}

.modal-body {
  padding: 18px 20px 4px;
}

.modal-body textarea {
  min-height: 150px;
  resize: vertical;
}

.modal-hint {
  margin: -4px 0 8px;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px 20px;
}
.modal-actions .btn {
  min-width: 112px;
  border-radius: 10px;
}

.user-panel {
  margin-top: auto;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg4);
}
.user-panel .grow {
  flex: 1;
  min-width: 0;
}
.user-panel b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-panel small {
  color: var(--muted);
  font-size: 12px;
}

.user-panel-actions {
  display: flex;
  gap: 4px;
}
.user-panel-actions button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  transition: background 0.1s;
}
.user-panel-actions button:hover {
  background: var(--hover);
  color: var(--text);
}

.pill.hot {
  background: rgba(218, 55, 60, 0.12);
  border-color: rgba(218, 55, 60, 0.3);
  color: #f0a0a0;
}

.pill.pin {
  background: rgba(88, 101, 242, 0.1);
  border-color: rgba(88, 101, 242, 0.25);
  color: var(--accent);
}

.call-indicator {
  font-size: 11px;
  color: var(--ok);
  font-weight: 600;
}

.call-layer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.call-popup {
  pointer-events: auto;
  width: min(340px, 100vw - 32px);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(88, 101, 242, 0.12);
  padding: 16px;
  animation: callSlideIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.call-popup.incoming {
  border-color: rgba(88, 101, 242, 0.45);
}
.call-popup.outgoing {
  border-color: rgba(35, 165, 90, 0.35);
}

@keyframes callSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.call-popup-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.call-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.call-avatar-wrap .avatar,
.call-avatar-wrap .avatar.big {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

.call-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: callPulse 1.6s ease-out infinite;
  pointer-events: none;
}
.call-ring.delay {
  animation-delay: 0.55s;
}

@keyframes callPulse {
  0% {
    transform: scale(0.92);
    opacity: 0.85;
  }
  70% {
    transform: scale(1.18);
    opacity: 0;
  }
  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}
.call-wave {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
  margin-top: 6px;
}
.call-wave span {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  animation: callWave 0.9s ease-in-out infinite;
}
.call-wave span:nth-child(1) {
  animation-delay: 0s;
  height: 8px;
}
.call-wave span:nth-child(2) {
  animation-delay: 0.12s;
  height: 14px;
}
.call-wave span:nth-child(3) {
  animation-delay: 0.24s;
  height: 10px;
}
.call-wave span:nth-child(4) {
  animation-delay: 0.36s;
  height: 16px;
}
.call-wave span:nth-child(5) {
  animation-delay: 0.48s;
  height: 9px;
}

@keyframes callWave {
  0%, 100% {
    transform: scaleY(0.45);
    opacity: 0.5;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}
.call-popup-title {
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 2px;
}

.call-popup-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.call-popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.call-popup-actions .btn {
  flex: 1;
}

.btn.call-decline {
  background: var(--danger);
}
.btn.call-decline:hover {
  background: #b52e32;
}

.btn.call-accept {
  background: var(--ok);
}
.btn.call-accept:hover {
  background: #1a8b48;
}

.search-field {
  position: relative;
  margin-bottom: 12px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
}

.search-field input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--text);
  outline: none;
}
.search-field input:focus {
  border-color: var(--accent);
}

.search-results {
  max-height: 320px;
  overflow-y: auto;
}

.user-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  transition: background 0.1s;
}
.user-result:hover {
  background: var(--hover);
  cursor: pointer;
}
.user-result .btn {
  flex-shrink: 0;
}

.user-result-info {
  cursor: pointer;
}

.friend-row .btn {
  flex-shrink: 0;
}

.friend-row {
  gap: 12px;
}

.friend-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.search-user-row .btn {
  flex-shrink: 0;
}

.auth-error {
  margin: 8px 0 12px;
  color: #ffb4b8;
  font-size: 13px;
}

.auth-hint {
  margin: 0 0 8px;
  font-size: 13px;
}

.server-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.server-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  background: var(--bg2);
}
.server-hero .server-icon {
  width: 72px;
  height: 72px;
  font-size: 26px;
}
.server-hero h2 {
  margin: 0 0 4px;
}
.server-hero p {
  margin: 0;
}

.server-hero::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: rgba(7, 8, 11, 0.48);
  content: "";
  pointer-events: none;
}

.server-section-title {
  margin: 10px 2px 0;
  color: var(--text1);
}

.member-row {
  gap: 10px;
}

.member-row .status-dot {
  margin-left: auto;
}

.voice-participants {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.voice-participant {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 10px;
  transition: border-color 0.15s, background 0.15s;
}
.voice-participant:hover {
  border-color: var(--hover);
  background: rgba(255, 255, 255, 0.05);
}
.voice-participant.screen-sharing {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.voice-state-pill {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.voice-state-pill.live {
  color: var(--ok);
  background: rgba(35, 165, 90, 0.12);
}
.voice-state-pill.sharing {
  color: var(--accent);
  background: rgba(88, 101, 242, 0.15);
}
.voice-state-pill.muted {
  color: var(--muted);
  background: var(--hover);
}

#globalSearch {
  width: 100%;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--text);
  outline: none;
}
#globalSearch:focus {
  border-color: var(--accent);
}

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(17, 18, 20, 0.96);
  border-top: 1px solid var(--line);
  z-index: 50;
  align-items: center;
  justify-content: space-around;
  backdrop-filter: blur(14px);
  gap: 0;
}
.mobile-nav button {
  min-width: 52px;
  height: 52px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.1s, background 0.1s, transform 0.1s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 6px;
}
.mobile-nav button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.mobile-nav button.active {
  color: #fff;
  background: rgba(88, 101, 242, 0.22);
}

.mobile-nav-icon {
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
}

.mobile-nav-label {
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
}

.mobile-server-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.mobile-server-dots .mobile-server-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.mobile-server-dots .mobile-server-dot.active {
  background: var(--accent);
  color: #fff;
}

/* Servers sheet/modal */
.servers-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.15s ease;
}
.servers-sheet .servers-sheet-card {
  width: 100%;
  max-height: 65vh;
  background: var(--bg2);
  border-radius: 16px 16px 0 0;
  padding: 20px 16px env(safe-area-inset-bottom);
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}
.servers-sheet .servers-sheet-card h3 {
  margin: 0 0 12px;
  font-size: 17px;
}
.servers-sheet .server-sheet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.1s;
}
.servers-sheet .server-sheet-row:hover {
  background: var(--hover);
}
.servers-sheet .server-sheet-row.active {
  background: rgba(88, 101, 242, 0.12);
}
.servers-sheet .server-sheet-row .server-icon {
  width: 36px;
  height: 36px;
  font-size: 14px;
}
.servers-sheet .server-sheet-row .grow {
  flex: 1;
  min-width: 0;
}
.servers-sheet .server-sheet-row b {
  display: block;
  font-size: 15px;
}
.servers-sheet .server-sheet-row small {
  color: var(--muted);
  font-size: 12px;
}

.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}
.drawer-overlay.open {
  display: block;
}

@media (max-width: 1100px) {
  .right {
    display: none;
  }
}
@media (max-width: 760px) {
  :root {
    --rail-w: 0px;
    --side-w: 280px;
  }
  .rail {
    display: none;
  }
  .layout {
    flex-direction: column;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
  .side {
    position: fixed;
    top: 0;
    left: -100%;
    width: var(--side-w);
    height: 100%;
    z-index: 50;
    transition: left 0.2s ease;
    box-shadow: var(--shadow);
  }
  .side.open {
    left: 0;
  }
  .main {
    width: 100%;
  }
  .topbar .mobile-back {
    display: inline-flex;
    padding: 4px;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 20px;
  }
  .mobile-nav {
    display: flex;
  }
  .composer {
    position: sticky;
    bottom: 0;
    padding: 8px 10px 10px;
    background: var(--bg3);
  }
  .composer textarea {
    min-height: 42px;
    max-height: 112px;
    border-radius: 16px;
  }
  .composer-footer {
    align-items: flex-end;
  }
  .composer-footer small {
    display: none;
  }
  .composer-footer .btn {
    border-radius: 14px;
    min-width: 78px;
  }
  .content {
    padding: 12px;
  }
  .messages {
    padding: 0 4px 4px;
  }
  .topbar {
    padding: 0 12px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(30, 31, 34, 0.96);
    backdrop-filter: blur(12px);
  }
  .right {
    display: none;
  }
  .call-layer {
    bottom: 72px;
    right: 12px;
  }
  .hero-card {
    grid-template-columns: 1fr;
    padding: 18px;
    border-radius: 16px;
  }
  .hero-card h1 {
    font-size: 30px;
  }
  .hero-actions .btn {
    flex: 1;
  }
  .stat-grid, .home-columns {
    grid-template-columns: 1fr;
  }
  .section-head {
    align-items: flex-start;
  }
  .section-head .btn {
    flex-shrink: 0;
  }
  .grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .forum-thread {
    padding: 10px 8px;
  }
  .vote-column {
    width: 34px;
  }
  .msg {
    padding: 8px 6px;
    margin: 0;
    gap: 10px;
    border-radius: 10px;
  }
  .msg-actions {
    position: static;
    display: flex;
    margin-top: 6px;
    width: fit-content;
  }
  .dm-row {
    min-height: 64px;
    border-radius: 14px;
  }
  .dm-row .avatar {
    width: 44px;
    height: 44px;
  }
  .dm-list-card {
    padding: 4px;
  }
  .profile-body {
    flex-direction: column;
  }
  .profile-body .avatar.big {
    margin-top: -48px;
  }
  .settings-page {
    display: block;
    overflow: visible;
  }
  .settings-sidebar {
    width: auto;
    display: flex;
    gap: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px;
    overflow-x: auto;
    position: sticky;
    top: 48px;
    z-index: 10;
  }
  .settings-tab {
    white-space: nowrap;
    margin-bottom: 0;
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .settings-content {
    padding: 12px 0 0;
    overflow: visible;
  }
  .settings-card {
    max-width: none;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .settings-banner {
    height: 150px;
    padding: 0 14px 14px;
  }
  .settings-fields {
    padding: 48px 14px 16px;
  }
  .settings-sidebar {
    top: 0;
    padding: 6px 10px;
    background: var(--bg3);
    gap: 4px;
  }
}
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 22px;
  padding: 4px;
}
@media (max-width: 760px) {
  .sidebar-toggle {
    display: inline-flex;
  }
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--hover);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--active);
}

.user-popup-card {
  max-width: 360px !important;
  padding: 0 !important;
  overflow: hidden;
  position: relative;
}

.popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.5) !important;
  color: #fff !important;
  border-radius: 50% !important;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 16px;
}
.popup-close:hover {
  background: rgba(0, 0, 0, 0.7) !important;
}

.popup-banner {
  height: 100px;
  background: var(--bg);
  background-size: cover;
  background-position: center;
}

.popup-avatar-wrap {
  margin-top: -40px;
  padding: 0 16px;
  display: flex;
}
.popup-avatar-wrap .avatar.big {
  width: 80px;
  height: 80px;
  font-size: 28px;
  border: 4px solid var(--bg);
}

.popup-body {
  padding: 12px 16px 16px;
}
.popup-body h2 {
  margin: 8px 0 0;
  font-size: 20px;
  font-weight: 700;
}

.popup-body .muted {
  font-size: 14px;
  margin: 2px 0 8px;
}

.popup-status-row {
  margin: 8px 0;
}
.popup-status-row .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.popup-bio {
  margin: 8px 0 12px;
  font-size: 14px;
  color: var(--text2);
  line-height: 1.4;
}

.popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.popup-actions .btn {
  flex: 1;
  min-width: 0;
}

.thread-listing {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: hidden;
}

.forum-thread {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, transform 0.1s, box-shadow 0.1s;
}
.forum-thread:hover {
  background: var(--hover);
  border-color: rgba(88, 101, 242, 0.38);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.vote-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 44px;
  flex-shrink: 0;
  padding: 2px 0 0;
}

.vote-btn {
  width: 28px;
  height: 24px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  padding: 0;
  line-height: 1;
  transition: color 0.1s, background 0.1s, transform 0.1s;
}
.vote-btn:hover {
  background: var(--bg);
  transform: translateY(-1px);
}
.vote-btn.up:hover, .vote-btn.up.active {
  color: #ff6a3d;
}
.vote-btn.down:hover, .vote-btn.down.active {
  color: #7193ff;
}
.vote-btn.active {
  background: var(--bg);
}

.vote-count {
  font-size: 13px;
  font-weight: 800;
  color: var(--text1);
  line-height: 1.2;
}

.thread-content {
  flex: 1;
  min-width: 0;
}
.thread-content .thread-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 7px;
  color: var(--text1);
  letter-spacing: -0.01em;
}

.thread-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--muted);
  align-items: center;
}
.thread-meta .clickable-user {
  cursor: pointer;
  font-weight: 600;
  color: var(--text2);
}
.thread-meta .clickable-user:hover {
  color: var(--accent);
  text-decoration: underline;
}

.thread-excerpt {
  margin: 8px 0 0;
  color: var(--text2);
  font-size: 13px;
  line-height: 1.45;
  max-width: 760px;
}

.thread-post {
  display: flex !important;
  align-items: flex-start;
  gap: 12px;
  padding: 18px;
  border-radius: 16px;
}
.thread-post .vote-column {
  padding-top: 4px;
}
.thread-post .post-body {
  flex: 1;
  min-width: 0;
}
.thread-post .post-body .thread-title {
  margin-top: 0;
  font-size: 26px;
  line-height: 1.15;
}

.replies-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
}
.replies-head h2 {
  margin: 0;
  font-size: 16px;
}

.reply-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.reply-stack .post.card {
  margin: 0;
  border-radius: 14px;
}

.locked-banner {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg2);
  color: var(--muted);
  padding: 12px 14px;
  text-align: center;
}

.join-call-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  flex-shrink: 0;
}
.join-call-banner span {
  flex: 1;
}
.join-call-banner .btn {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 13px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-child {
  border-bottom: none;
}
.setting-row label {
  font-size: 14px;
  font-weight: 500;
}
.setting-row small {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: none;
  background: var(--hover);
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
  flex-shrink: 0;
}
.toggle.on {
  background: var(--ok);
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.toggle.on::after {
  transform: translateX(20px);
}

.clickable-user {
  cursor: pointer;
}
.clickable-user:hover {
  filter: brightness(1.2);
}

.ctx-menu {
  position: fixed;
  z-index: 500;
  min-width: 188px;
  max-width: 260px;
  background: var(--bg4);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  padding: 6px 8px;
  animation: ctxIn 0.12s ease;
}

.ctx-backdrop {
  position: fixed;
  inset: 0;
  z-index: 499;
}

@keyframes ctxIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  text-align: left;
  transition: background 0.1s, color 0.1s;
}
.ctx-item:hover, .ctx-item:focus-visible {
  background: var(--accent);
  color: #fff;
  outline: none;
}
.ctx-item.ctx-danger:hover, .ctx-item.ctx-danger:focus-visible {
  background: var(--danger);
  color: #fff;
}

.ctx-sep-before {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 10px;
}

.ctx-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
}

.ctx-sep {
  height: 1px;
  background: var(--line);
  margin: 4px 8px;
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg3);
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  color: var(--text2);
  border-bottom: 1px solid var(--line);
}
.reply-bar .reply-to-label {
  white-space: nowrap;
}
.reply-bar .reply-preview-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-style: italic;
}
.reply-bar #cancelReply {
  flex-shrink: 0;
  padding: 2px 8px;
  font-size: 14px;
  color: var(--text2);
}

.msg .reply-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 4px;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}
.msg .reply-preview:hover {
  background: var(--hover);
}

.reply-line {
  display: block;
  width: 2px;
  height: 28px;
  border-radius: 2px;
  background: var(--accent);
  flex-shrink: 0;
}

.reply-author {
  color: var(--text1);
  font-weight: 600;
}

@keyframes highlight-flash {
  0% {
    background: transparent;
  }
  30% {
    background: rgba(88, 101, 242, 0.3);
  }
  100% {
    background: transparent;
  }
}
@media (max-width: 700px) {
  .call-layer {
    bottom: 70px;
    right: 8px;
    left: 8px;
  }
  .call-popup {
    width: auto;
  }
}
.call-layer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}
.call-layer > * {
  pointer-events: auto;
}

.call-popup {
  background: var(--bg4);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  width: 340px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(255, 255, 255, 0.035);
  animation: callSlideIn 0.2s ease;
  backdrop-filter: blur(16px);
}
.call-popup.incoming {
  border-color: var(--accent);
}
.call-popup.outgoing {
  border-color: var(--ok);
}
.call-popup.active-call {
  cursor: grab;
  border-color: rgba(35, 165, 90, 0.55);
  background: color-mix(in srgb, var(--bg2), var(--ok) 8%);
}
.call-popup.active-call:active {
  cursor: grabbing;
}

.call-popup-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.call-avatar-wrap .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.call-popup-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text1);
}

.call-popup-sub {
  font-size: 13px;
  color: var(--muted);
}

.call-popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.call-popup-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.call-popup-controls .btn {
  justify-content: center;
}

.call-decline {
  background: var(--danger) !important;
  color: #fff !important;
}

.call-accept {
  background: var(--ok) !important;
  color: #fff !important;
}

.call-muted {
  background: var(--danger) !important;
  color: #fff !important;
  opacity: 0.85;
}
.call-muted:hover {
  background: #b52e32 !important;
}

.call-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  animation: callPulse 1.5s ease infinite;
}
.call-ring.delay {
  animation-delay: 0.5s;
}

@keyframes callPulse {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}
.call-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  margin-top: 4px;
}
.call-wave span {
  width: 3px;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  animation: callWave 1s ease infinite;
}
.call-wave span:nth-child(2) {
  animation-delay: 0.1s;
}
.call-wave span:nth-child(3) {
  animation-delay: 0.2s;
}
.call-wave span:nth-child(4) {
  animation-delay: 0.3s;
}
.call-wave span:nth-child(5) {
  animation-delay: 0.4s;
}

@keyframes callWave {
  0%, 100% {
    height: 4px;
  }
  50% {
    height: 20px;
  }
}
.call-status-dot.live {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ok);
  border: 2px solid var(--bg4);
}

/* Compact call bar (minimized overlay) */
.call-bar.compact {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg4);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 14px;
  width: 340px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(16px);
  cursor: pointer;
  transition: all 0.2s ease;
}
.call-bar.compact:hover {
  border-color: rgba(35, 165, 90, 0.45);
  transform: translateY(-1px);
}

.call-bar-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(35, 165, 90, 0.35);
  animation: callLivePulse 2.2s ease infinite;
}

@keyframes callLivePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(35, 165, 90, 0.26);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(35, 165, 90, 0);
  }
}
.call-bar-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.call-bar-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text1);
}

.call-bar-sub {
  font-size: 12px;
  color: var(--muted);
}

.call-bar-avatars {
  display: flex;
  align-items: center;
}
.call-bar-avatars .avatar.small {
  width: 28px;
  height: 28px;
  font-size: 11px;
  margin-left: -6px;
}
.call-bar-avatars .avatar.small:first-child {
  margin-left: 0;
}

.call-bar-controls {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 14px;
}
.btn.icon-btn:hover {
  background: var(--hover);
}

/* Expanded call overlay */
.call-overlay.expanded {
  width: 340px;
  background: var(--bg4);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(16px);
  overflow: hidden;
  animation: callSlideIn 0.2s ease;
}

.call-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.call-overlay-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.call-overlay-heading {
  min-width: 0;
  flex: 1;
}

.call-overlay-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.call-overlay-facepile {
  display: flex;
  align-items: center;
  min-width: 0;
}

.call-overlay-face {
  width: 25px;
  height: 25px;
  margin-left: -6px;
  padding: 0;
  border: 2px solid var(--bg4);
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: transform 0.14s ease, z-index 0.14s ease;
}
.call-overlay-face:first-child {
  margin-left: 0;
}
.call-overlay-face:hover, .call-overlay-face:focus-visible {
  transform: translateY(-2px) scale(1.06);
  z-index: 2;
  outline: none;
}
.call-overlay-face:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}
.call-overlay-face .avatar.tiny {
  width: 21px;
  height: 21px;
  margin: 0;
  font-size: 9px;
}

.call-overlay-face-overflow {
  min-width: 25px;
  height: 25px;
  margin-left: -5px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg4);
  border-radius: 999px;
  background: var(--bg2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.call-overlay-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.call-overlay-timer {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 4px;
}

.call-overlay-users {
  padding: 8px 0;
  max-height: 200px;
  overflow-y: auto;
}

.call-empty {
  padding: 18px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.call-empty::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 2px solid rgba(35, 165, 90, 0.25);
  border-top-color: var(--ok);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.call-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
}
.call-user-row .avatar.small {
  width: 32px;
  height: 32px;
  font-size: 13px;
  flex-shrink: 0;
}
.call-user-row .avatar.live {
  outline: 3px solid var(--ok);
  outline-offset: -1px;
  border-radius: 50%;
}

.call-user-identity {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 5px;
  margin: -3px -5px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.call-user-identity:hover {
  background: var(--hover);
}
.call-user-identity:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.call-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.call-user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text1);
}

.call-user-status {
  font-size: 12px;
  color: var(--ok);
}
.call-user-status.muted {
  color: var(--danger);
}
.call-user-status.deafened {
  color: var(--muted);
}
.call-user-status.failed {
  color: var(--danger);
}

.call-retry {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 9px;
  font-size: 11px;
}

.call-overlay-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
}
.call-overlay-controls .btn {
  flex: 1 1 calc(50% - 6px);
  justify-content: center;
  font-size: 13px;
  padding: 6px 8px;
}

/* DM call bar (top of DM view) */
.dm-call-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(35, 165, 90, 0.09);
  border-bottom: 1px solid rgba(35, 165, 90, 0.25);
  gap: 12px;
  flex-shrink: 0;
  box-shadow: inset 0 -1px 0 rgba(35, 165, 90, 0.08);
}

.dm-call-bar-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dm-call-bar-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.dm-call-bar-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text1);
}

.dm-call-bar-timer {
  font-size: 13px;
  color: var(--muted);
}

.dm-call-bar-count {
  font-size: 12px;
  color: var(--muted);
}

.dm-call-bar-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .call-bar.compact {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    padding: 10px;
    gap: 8px;
  }
  .call-overlay.expanded {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
  }
  .call-bar-controls .btn.icon-btn {
    width: 38px;
    height: 38px;
  }
  .call-bar-info {
    min-width: 84px;
  }
  .call-overlay-controls .btn {
    min-height: 40px;
  }
  .voice-actions .btn {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }
  .dm-call-bar {
    flex-wrap: wrap;
  }
  .dm-call-bar-main {
    flex: 1 1 100%;
  }
  .call-bar-avatars {
    display: none;
  }
  .call-layer {
    right: 10px;
    left: 10px;
  }
}
.settings-page {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: visible;
}

.settings-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg2);
  padding: 16px 8px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.settings-tab {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s;
  margin-bottom: 2px;
}
.settings-tab:hover {
  background: var(--hover);
  color: var(--text1);
}
.settings-tab.active {
  background: var(--accent);
  color: #fff;
}

.settings-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 32px;
}

.settings-tab-content {
  display: none;
}
.settings-tab-content.active {
  display: block;
}

.settings-card {
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  width: min(760px, 100%);
  max-width: 100%;
}

.settings-banner {
  height: 120px;
  background: var(--bg2);
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 0 20px 16px;
  gap: 16px;
}

.settings-avatar-wrap .avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid var(--bg3);
  margin-bottom: -36px;
}

.settings-name-block {
  margin-bottom: 4px;
}
.settings-name-block h2 {
  margin: 0;
  font-size: 18px;
}

.settings-fields {
  padding: 52px 20px 20px;
}

.settings-fields .field textarea {
  min-height: 110px;
  resize: vertical;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.toggle-row .btn.toggle {
  min-width: 60px;
  justify-content: center;
}
.toggle-row .btn.toggle.active {
  background: var(--ok);
  color: #fff;
}
.toggle-row .btn.toggle.active:hover {
  background: #1e8a4a;
}

.file-upload-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}
.file-upload-row input[type=text] {
  flex: 1;
}
.file-upload-row input[type=file] {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* shared responsive odds and ends */
:root {
  --page-pad: clamp(14px, 2vw, 24px);
}

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [role=button]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input, textarea, select {
  min-width: 0;
  max-width: 100%;
}

img {
  max-width: 100%;
}

.image-failed {
  background: var(--hover);
}

.avatar.image-failed {
  color: var(--text) !important;
  font-weight: 700;
  line-height: normal;
  text-align: center;
}

.content {
  padding: var(--page-pad);
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.topbar {
  min-width: 0;
}

.topbar h2 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-head .server-icon {
  margin-bottom: 10px;
}

.side-head .nav-actions {
  gap: 8px;
}

.side-head .nav-actions .btn {
  flex: 1 1 calc(50% - 4px);
  padding-inline: 10px;
}

.row, .user-result, .member-row, .server-sheet-row, .card, .forum-card,
.forum-thread, .settings-card {
  min-width: 0;
}

.thread-title, .thread-excerpt, .post-body, .popup-bio {
  overflow-wrap: anywhere;
}

.modal-card {
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.toast {
  bottom: max(20px, env(safe-area-inset-bottom));
  right: max(20px, env(safe-area-inset-right));
}

.auth-layout {
  overflow-y: auto;
}

.auth-layout .content {
  display: grid;
  place-items: center;
  min-height: 100%;
}

.auth-card {
  width: min(520px, 100%);
  margin: auto;
  padding: clamp(20px, 4vw, 32px) !important;
}

.auth-card h1 {
  margin: 0 0 6px;
  color: var(--text1);
}

.auth-card > p {
  margin-top: 0;
}

.auth-card .tabs .btn {
  flex: 1;
}

.auth-card > div > .btn:last-child {
  width: 100%;
  min-height: 44px;
}

@media (min-width: 761px) {
  .home-page, .forum-page, .server-page, .thread-page, .dm-inbox {
    width: min(1180px, 100%);
    margin-inline: auto;
  }
  .settings-content > *, .profile, .invite-card {
    margin-inline: auto;
  }
  .messages, .composer {
    padding-inline: clamp(16px, 3vw, 36px);
  }
}
@media (max-width: 760px) {
  :root {
    --side-w: Min(88vw, 320px);
    --page-pad: 12px;
    --header-h: calc(52px + env(safe-area-inset-top));
  }
  html, body {
    overscroll-behavior: none;
  }
  .layout {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
  .auth-layout {
    padding-bottom: 0;
  }
  .main {
    min-height: 0;
  }
  .side {
    width: var(--side-w);
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .side-head {
    padding-top: calc(16px + env(safe-area-inset-top));
  }
  .topbar {
    height: var(--header-h);
    padding: env(safe-area-inset-top) 12px 0;
    gap: 8px;
  }
  .sidebar-toggle {
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    margin-left: -8px;
  }
  .mobile-nav {
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 4px max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
    justify-content: stretch;
    overflow: hidden;
  }
  .mobile-nav button {
    flex: 1 1 0;
    min-width: 0;
    height: 52px;
    padding-inline: 2px;
  }
  .mobile-server-dots {
    display: none;
  }
  .servers-sheet .servers-sheet-card {
    max-height: min(78dvh, 680px);
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .content {
    scroll-padding-top: var(--header-h);
    scroll-padding-bottom: 96px;
  }
  .hero-card {
    gap: 16px;
  }
  .hero-actions, .action-row, .forum-header-actions, .forum-view-actions {
    width: 100%;
  }
  .hero-actions .btn, .forum-header-actions .btn, .forum-view-actions .btn {
    flex: 1 1 140px;
  }
  .forum-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .forum-card-footer {
    gap: 8px;
  }
  .thread-post {
    padding: 12px 10px;
    gap: 8px;
  }
  .thread-post .post-body .thread-title {
    font-size: clamp(20px, 6vw, 25px);
  }
  .chat-surface {
    min-height: calc(100dvh - var(--header-h) - 64px - env(safe-area-inset-bottom) - 24px);
    border-radius: 14px;
  }
  .chat-header {
    padding: 10px 12px;
    gap: 10px;
  }
  .chat-header .avatar {
    width: 38px;
    height: 38px;
  }
  .chat-header .btn {
    min-width: 44px;
    padding-inline: 10px;
  }
  .messages {
    padding: 4px 2px 8px;
  }
  .msg {
    align-items: flex-start;
  }
  .msg-main {
    min-width: 0;
    flex: 1;
  }
  .msg-head {
    flex-wrap: wrap;
    gap: 4px 8px;
  }
  .msg-body {
    font-size: 15px;
    overflow-wrap: anywhere;
  }
  .compact-time {
    display: none;
  }
  .msg-actions {
    gap: 2px;
    border: 0;
    box-shadow: none;
    background: transparent;
  }
  .msg-actions .msg-action {
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--bg2);
    font-size: 12px;
  }
  .composer {
    padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  }
  .composer textarea {
    font-size: 16px;
  }
  .composer-footer {
    gap: 8px;
  }
  .modal {
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
    align-items: end;
  }
  .modal-card, .action-modal {
    width: 100%;
    max-height: min(88dvh, 760px);
    border-radius: 18px;
  }
  .modal-head {
    padding: 16px;
  }
  .modal-head h2 {
    font-size: 20px;
  }
  .modal-body {
    padding: 16px 16px 4px;
  }
  .modal-actions {
    padding: 14px 16px 16px;
  }
  .modal-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
  }
  .invite-code-box {
    flex-wrap: wrap;
  }
  .invite-code-box .btn {
    flex: 1 1 100%;
  }
  .call-layer {
    inset: auto 8px calc(68px + env(safe-area-inset-bottom));
    max-height: calc(100dvh - 88px - env(safe-area-inset-bottom));
  }
  .call-popup, .call-bar.compact, .call-overlay.expanded {
    width: 100%;
    max-width: none;
  }
  .call-popup.active-call {
    position: relative !important;
    inset: auto !important;
    cursor: default;
  }
  /* desktop rules came later. mobile gets the last word here. */
  .settings-page {
    display: block;
    overflow: visible;
  }
  .settings-sidebar {
    width: auto;
    display: flex;
    gap: 4px;
    padding: 6px 2px 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg3);
    scrollbar-width: none;
  }
  .settings-sidebar::-webkit-scrollbar {
    display: none;
  }
  .settings-tab {
    display: inline-flex;
    flex: 0 0 auto;
    min-height: 42px;
    align-items: center;
    padding: 9px 14px;
    margin: 0;
    white-space: nowrap;
  }
  .settings-content {
    padding: 12px 0 0;
    overflow: visible;
  }
  .settings-card {
    width: 100%;
    border-radius: 14px;
  }
  .settings-banner {
    height: 140px;
    padding: 0 14px 14px;
  }
  .settings-fields {
    padding: 48px 14px 16px;
  }
  .file-upload-row {
    flex-wrap: wrap;
  }
  .file-upload-row input[type=text], .file-upload-row input[type=file] {
    flex: 1 1 100%;
  }
  .setting-row, .toggle-row {
    align-items: flex-start;
    gap: 16px;
  }
  .toast {
    left: 10px;
    right: 10px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    max-width: none;
    text-align: center;
    justify-content: center;
  }
}
@media (max-width: 390px) {
  .mobile-nav-label {
    font-size: 10px;
  }
  .mobile-nav-icon {
    font-size: 18px;
  }
  .stat-card {
    padding: 14px;
  }
  .forum-card-top {
    padding-inline: 12px;
  }
  .call-popup-controls {
    grid-template-columns: 1fr;
  }
}
@media (max-height: 620px) and (max-width: 760px) {
  .modal-card, .action-modal {
    max-height: 94dvh;
  }
  .call-overlay-users {
    max-height: 120px;
  }
  .servers-sheet .servers-sheet-card {
    max-height: 86dvh;
  }
}
@media (hover: none) and (pointer: coarse) {
  .btn, .row, .rail-btn, .user-panel-actions button, .vote-btn, .ctx-item {
    min-height: 44px;
  }
  .msg-actions {
    display: flex;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
/* density pass */
:root, [data-theme=dark] {
  --surface-soft: rgba(255,255,255,.025);
  --surface-raised: rgba(43,45,49,.94);
  --surface-header: rgba(30,31,34,.9);
  --hover-soft: rgba(255,255,255,.045);
  --content-max: 1120px;
}

[data-theme=light] {
  --surface-soft: rgba(0,0,0,.018);
  --surface-raised: rgba(255,255,255,.78);
  --surface-header: rgba(242,243,245,.92);
  --hover-soft: rgba(0,0,0,.045);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme=dark]):not([data-theme=light]) {
    --surface-soft: rgba(0,0,0,.018);
    --surface-raised: rgba(255,255,255,.78);
    --surface-header: rgba(242,243,245,.92);
    --hover-soft: rgba(0,0,0,.045);
  }
}
.side {
  border-right-color: color-mix(in srgb, var(--line), transparent 24%);
}

.side-head {
  padding: 14px 14px 13px;
  min-height: var(--header-h);
}

.side .list {
  padding: 8px 7px 12px;
}

.side .row {
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
}

.side .row + .row {
  margin-top: 1px;
}

.topbar {
  padding-inline: 18px;
  background: var(--surface-header);
  border-bottom-color: color-mix(in srgb, var(--line), transparent 20%);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(14px);
}

.content {
  padding-top: clamp(16px, 2vw, 22px);
  padding-bottom: clamp(20px, 3vw, 32px);
}

.home-page, .forum-page, .server-page, .thread-page, .dm-inbox {
  max-width: var(--content-max);
}

.card, .forum-card, .forum-thread, .settings-card {
  border-color: color-mix(in srgb, var(--line), transparent 15%);
}

.btn {
  border-radius: 6px;
}

.btn.ghost:hover {
  background: var(--hover-soft);
  color: var(--text1);
}

.chat-surface {
  border-radius: 12px;
  background: var(--surface-soft);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}

.chat-header {
  padding: 11px 16px;
  background: var(--surface-header);
  backdrop-filter: blur(14px);
}

.messages {
  padding-top: 16px;
  padding-bottom: 14px;
}

.msg {
  padding-block: 5px;
  border-radius: 6px;
}

.msg:hover {
  background: var(--hover-soft);
  box-shadow: none;
}

.msg.mine:hover {
  background: rgba(88, 101, 242, 0.065);
}

.msg-body {
  color: var(--text);
  line-height: 1.46;
}

.composer {
  padding-top: 8px;
  background: var(--surface-soft);
}

.composer textarea {
  border-radius: 10px;
  background: var(--surface-raised);
  box-shadow: none;
}

.composer textarea:focus {
  background: var(--surface-raised);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.13);
}

.forum-directory-hero, .forum-view-header {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.forum-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.forum-card {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.forum-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
}

.forum-thread {
  padding-block: 13px;
  background: var(--surface-raised);
}

.thread-actions {
  margin-top: 6px;
}

.thread-action {
  background: transparent;
}

.thread-action.primary {
  background: var(--surface-soft);
}

.forum-reply {
  background: var(--surface-raised);
  box-shadow: none;
}

.user-panel {
  padding: 8px 10px;
  background: color-mix(in srgb, var(--bg3), var(--bg) 50%);
}

@media (max-width: 760px) {
  .topbar {
    padding-inline: 12px;
  }
  .content {
    padding-top: 12px;
    padding-bottom: 18px;
  }
  .chat-surface {
    border-radius: 10px;
  }
  .messages {
    padding-top: 10px;
  }
  .forum-directory-hero, .forum-view-header {
    border-radius: 14px;
  }
}
/* Forum experience */
.forum-directory-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid rgba(88, 101, 242, 0.3);
  border-radius: 18px;
  background: var(--bg2);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
}
.forum-directory-hero .forum-header-title {
  position: relative;
  z-index: 1;
}
.forum-directory-hero h2 {
  margin: 5px 0 6px;
  font-size: clamp(25px, 4vw, 38px);
  letter-spacing: -0.035em;
  color: var(--text1);
}
.forum-directory-hero .forum-header-actions {
  align-self: center;
  position: relative;
  z-index: 1;
}
.forum-directory-hero .btn {
  min-height: 44px;
  border-radius: 11px;
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.2);
}

.forum-search {
  margin-top: 4px;
}

.forum-search .forum-search-input {
  min-height: 46px;
  background: var(--bg2);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}
.forum-search .forum-search-input:focus {
  box-shadow: var(--focus-ring, 0 0 0 3px rgba(88, 101, 242, 0.2));
}

.forum-section-title {
  margin-top: 22px;
  padding-left: 2px;
  letter-spacing: 0.09em;
}

.forum-grid {
  gap: 14px;
}

.forum-card {
  border-radius: 15px;
  background: var(--bg2);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.forum-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 38px rgba(0, 0, 0, 0.2);
}

.forum-card-top {
  padding: 17px 16px 10px;
  gap: 14px;
}

.forum-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--accent);
  box-shadow: 0 6px 18px rgba(88, 101, 242, 0.24);
}

.forum-card-kicker {
  display: block;
  margin-bottom: 2px;
  color: #9ea7ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.forum-card-name {
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}

.forum-card-stats {
  padding: 5px 16px 12px;
  flex-wrap: wrap;
  row-gap: 3px;
}

.forum-card-footer {
  padding: 10px 16px;
  background: rgba(17, 18, 20, 0.32);
}

.forum-join-btn, .forum-joined-btn {
  min-height: 32px;
  padding-inline: 16px;
}

.forum-owner-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 11%, var(--surface-soft));
  color: var(--text1);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.thread-membership-gate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text2);
}
.thread-membership-gate > span {
  min-width: 0;
  line-height: 1.45;
}
.thread-membership-gate .btn {
  flex: 0 0 auto;
}

.forum-view-header {
  padding: clamp(18px, 3vw, 28px);
  border-radius: 17px;
  background: var(--bg2);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.14);
}
.forum-view-header .forum-card-icon.large {
  width: 58px;
  height: 58px;
  border-radius: 17px;
}
.forum-view-header h2 {
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.025em;
}
.forum-view-header .forum-view-title > div {
  min-width: 0;
}
.forum-view-header p {
  max-width: 720px;
  overflow-wrap: anywhere;
}

.thread-listing {
  gap: 9px;
}

.forum-thread {
  position: relative;
  gap: 14px;
  padding: 15px 17px 14px 12px;
  border-radius: 13px;
  background: var(--bg2);
}
.forum-thread:hover {
  transform: none;
  border-color: rgba(88, 101, 242, 0.55);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.vote-column {
  width: 42px;
  gap: 1px;
  padding: 1px 0;
  border-radius: 10px;
}

.vote-btn {
  width: 34px;
  height: 30px;
  border-radius: 9px;
  font-size: 17px;
}
.vote-btn:focus-visible {
  outline-offset: 0;
}
.vote-btn.up:hover, .vote-btn.up.active {
  color: #ff7043;
  background: rgba(255, 112, 67, 0.12);
}
.vote-btn.down:hover, .vote-btn.down.active {
  color: #7193ff;
  background: rgba(113, 147, 255, 0.12);
}

.vote-count {
  padding: 2px 0;
  font-size: 14px;
}

.thread-content .thread-title {
  margin-bottom: 5px;
  font-size: 18px;
  line-height: 1.3;
}

.thread-meta {
  gap: 4px 7px;
}

.thread-meta .avatar.tiny {
  margin-right: 1px;
}

.thread-meta .thread-author {
  color: var(--text1);
  font-weight: 700;
}

.thread-excerpt {
  margin: 9px 0 10px;
  max-width: 840px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.thread-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.thread-action {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.thread-action.primary {
  color: var(--text2);
  background: var(--bg3);
}

.thread-page {
  width: min(940px, 100%);
  margin-inline: auto;
}

.thread-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 2px 10px;
  color: var(--muted);
  font-size: 13px;
}
.thread-breadcrumb a {
  color: #9ea7ff;
  font-weight: 700;
}

.thread-post {
  padding: clamp(16px, 3vw, 26px) clamp(14px, 3vw, 28px) clamp(20px, 3vw, 30px) 14px;
  border-radius: 16px;
  background: var(--bg2);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.15);
}

.thread-post .post-meta {
  margin: 8px 0 20px;
}

.post-author-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.post-author-block .muted {
  font-size: 12px;
}

.thread-post-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 16px;
  line-height: 1.68;
}

.thread-post-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 24px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.replies-head {
  margin-top: 24px;
  padding: 0 2px;
}

.reply-stack {
  gap: 8px;
}

.forum-reply {
  display: flex;
  gap: 12px;
  padding: 14px 16px 15px 12px;
  border-radius: 13px !important;
  background: rgba(43, 45, 49, 0.72);
  transition: border-color 0.12s, background 0.12s;
}
.forum-reply:hover {
  border-color: rgba(88, 101, 242, 0.34);
  background: var(--bg2);
}

.reply-rail {
  width: 36px;
  flex: 0 0 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.reply-rail .avatar {
  width: 34px;
  height: 34px;
}

.reply-rail-line {
  width: 2px;
  min-height: 24px;
  flex: 1;
  margin-top: 8px;
  border-radius: 2px;
  background: var(--line2);
}

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

.reply-meta {
  gap: 7px;
  margin: 0 0 8px;
  min-height: 34px;
}

.reply-username {
  color: var(--muted);
  font-size: 12px;
}

.reply-number {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.reply-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 15px;
  line-height: 1.58;
}

.thread-page > .composer {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg2);
}

@media (max-width: 760px) {
  .forum-directory-hero {
    padding: 19px 16px;
  }
  .forum-directory-hero h2 {
    font-size: 27px;
  }
  .forum-directory-hero .forum-header-actions {
    width: 100%;
  }
  .forum-directory-hero .btn {
    width: 100%;
  }
  .forum-card-desc {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .forum-view-header .forum-view-title {
    gap: 11px;
  }
  .forum-view-header .forum-card-icon.large {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }
  .forum-thread {
    padding: 12px 10px 11px 6px;
    gap: 8px;
  }
  .vote-column {
    width: 36px;
  }
  .vote-btn {
    width: 34px;
    min-height: 34px;
  }
  .thread-content .thread-title {
    font-size: 16px;
  }
  .thread-excerpt {
    -webkit-line-clamp: 2;
    font-size: 13px;
  }
  .thread-action {
    padding-inline: 6px;
  }
  .thread-action:last-child {
    display: none;
  }
  .thread-post {
    padding: 14px 11px 18px 6px;
  }
  .thread-post .vote-column {
    width: 36px;
  }
  .thread-post .post-body .thread-title {
    font-size: 22px;
  }
  .thread-post .post-meta {
    align-items: center;
    margin-bottom: 16px;
  }
  .thread-post-body {
    font-size: 15px;
    line-height: 1.6;
  }
  .forum-reply {
    gap: 8px;
    padding: 12px 10px 13px 8px;
  }
  .reply-rail {
    width: 32px;
    flex-basis: 32px;
  }
  .reply-rail .avatar {
    width: 30px;
    height: 30px;
  }
  .reply-meta {
    min-height: 30px;
    gap: 5px;
  }
  .reply-username {
    display: none;
  }
  .reply-body {
    font-size: 14px;
    line-height: 1.55;
  }
  .thread-page > .composer {
    margin-inline: 0;
    padding: 10px;
  }
}
/* forum overrides live late on purpose */
.forum-directory-hero, .forum-view-header {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.forum-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.forum-card {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.forum-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
}

.forum-thread {
  padding-block: 13px;
  background: var(--surface-raised);
}

.thread-actions {
  margin-top: 6px;
}

.thread-action {
  background: transparent;
}

.thread-action.primary {
  background: var(--surface-soft);
}

.forum-reply {
  background: var(--surface-raised);
  box-shadow: none;
}

/* flatter community/server bits */
.forum-directory-hero {
  padding: 24px;
  border-color: var(--line);
  border-radius: 12px;
  background: var(--bg2);
  box-shadow: none;
}

.forum-directory-hero::after {
  display: none;
}

.forum-directory-hero .eyebrow {
  color: var(--muted);
  letter-spacing: 0.08em;
}

.forum-directory-hero h2 {
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.025em;
}

.forum-directory-hero .btn {
  border-radius: 6px;
  box-shadow: none;
}

.forum-search .forum-search-input {
  border-radius: 8px;
  box-shadow: none;
}

.forum-card {
  border-radius: 10px;
  background: var(--bg2);
  box-shadow: none;
}

.forum-card:hover {
  transform: none;
  border-color: var(--text2);
  box-shadow: none;
}

.forum-card-icon {
  border-radius: 50%;
  box-shadow: none;
  background: var(--accent);
}

.forum-card-footer {
  background: var(--surface-soft);
}

.forum-join-btn, .forum-joined-btn {
  border-radius: 6px;
}

.forum-view-header {
  border-radius: 12px;
  background: var(--bg2);
  box-shadow: none;
}

.thread-post {
  box-shadow: none;
  background: var(--bg2);
}

.rail {
  gap: 8px;
  padding-block: 10px;
}

.rail-btn, .rail-btn .server-icon {
  width: 46px;
  height: 46px;
}

.rail-btn {
  overflow: visible;
}

.rail-btn::before {
  left: -13px;
}

.rail-btn.active::before {
  height: 32px;
}

.rail-btn .server-icon {
  overflow: hidden;
}

.server-channel-list {
  padding-top: 12px !important;
}

.channel-group-title {
  padding: 10px 9px 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.server-channel-list .row, .server-channel-card .row {
  min-height: 38px;
  border-radius: 6px;
}

.server-channel-list .server-icon, .server-channel-card .server-icon {
  width: 24px;
  height: 24px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
}

.server-channel-list .row small, .server-channel-card .row small {
  display: none;
}

.server-channel-list .row b, .server-channel-card .row b {
  color: var(--text2);
  font-weight: 550;
}

.server-channel-list .row:hover b, .server-channel-card .row:hover b {
  color: var(--text1);
}

.server-channel-card {
  padding: 6px;
}

.server-channel-card .channel-group-title {
  padding-left: 11px;
}

.server-hero {
  padding: 20px !important;
  border-radius: 10px;
  background: var(--bg2);
}

.server-hero .server-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
}

.server-hero-actions {
  gap: 10px;
  margin-top: 14px;
}

.server-section-title {
  margin: 8px 4px -4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.friends-page {
  width: min(1040px, 100%);
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg2);
}

.friends-toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
}

.friends-toolbar h2 {
  margin: 0;
  padding-right: 18px;
  border-right: 1px solid var(--line);
  font-size: 18px;
}

.friends-tabs {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.friends-tabs::-webkit-scrollbar {
  display: none;
}

.friends-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.friends-tab:hover {
  color: var(--text1);
  background: var(--hover);
}

.friends-tab.active {
  color: var(--text1);
  background: var(--active);
}

.friends-tab:last-child {
  color: var(--ok);
}

.friends-tab:last-child.active {
  color: #fff;
  background: var(--ok);
}

.tab-count {
  min-width: 19px;
  padding: 1px 6px;
  border-radius: 10px;
  color: #fff;
  background: var(--danger);
  font-size: 11px;
  text-align: center;
}

.friends-content {
  min-height: 430px;
  padding: 18px;
  background: var(--bg3);
}

.friend-list-head {
  display: flex;
  justify-content: space-between;
  margin: 0 2px 12px;
}

.friend-list-head h3, .add-friend-panel h3 {
  margin: 0;
  color: var(--text1);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.friend-list-head p, .add-friend-panel > p {
  margin: 4px 0 0;
}

.friend-empty {
  padding: 56px 20px;
}

.friend-empty b {
  display: block;
  color: var(--text1);
  font-size: 16px;
}

.friend-empty p {
  margin: 6px 0 0;
}

.add-friend-panel {
  max-width: 820px;
}

.add-friend-intro {
  display: flex;
  align-items: center;
  gap: 13px;
}

.add-friend-intro p {
  margin: 4px 0 0;
}

.add-friend-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: var(--ok);
  box-shadow: 0 8px 20px rgba(35, 165, 90, 0.2);
  font-size: 25px;
  font-weight: 400;
}

.add-friend-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 16px;
  padding: 7px 7px 7px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg4);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(88, 101, 242, 0);
  transition: border-color 0.16s, box-shadow 0.16s;
}

.add-friend-form:focus-within {
  border-color: var(--accent);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18), 0 0 0 3px rgba(88, 101, 242, 0.14);
}

.add-friend-search-icon {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 23px;
  line-height: 1;
  transform: rotate(-18deg);
}

.add-friend-form input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 4px;
  border: 0 !important;
  outline: 0 !important;
  color: var(--text1) !important;
  background: transparent !important;
  caret-color: var(--accent);
  box-shadow: none !important;
}

.add-friend-form input::placeholder {
  color: var(--muted) !important;
  opacity: 1;
}

.add-friend-form .btn {
  flex-shrink: 0;
  min-width: 122px;
  height: 42px;
}

.add-friend-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: saturate(0.55);
}

.friend-discovery-hint {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 58px 18px 40px;
  color: var(--muted);
  text-align: center;
}

.friend-discovery-hint .discovery-art {
  display: grid;
  width: 68px;
  height: 68px;
  margin-bottom: 16px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 70%);
  border-radius: 18px;
  color: #aeb5ff;
  background: color-mix(in srgb, var(--accent), transparent 88%);
  font-size: 34px;
}

.friend-discovery-hint b {
  color: var(--text1);
  font-size: 16px;
}

.friend-discovery-hint p {
  max-width: 460px;
  margin: 6px 0 0;
  line-height: 1.55;
}

.friend-discovery-hint.compact {
  padding-block: 38px;
}

.friend-results {
  margin-top: 14px;
}

.relationship-label {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 13px;
}

.friends-head {
  margin-bottom: 12px;
}

.friends-head h2 {
  margin: 0;
  color: var(--text1);
}

.friends-head p {
  margin: 3px 0 0;
}

.friends-list {
  padding: 6px;
}

.friends-list .friend-row {
  min-height: 64px;
  padding: 9px 12px;
  border-radius: 8px;
}

.friends-list .friend-row + .friend-row {
  margin-top: 2px;
}

.friend-actions {
  gap: 10px;
  margin-left: 14px;
}

.friend-actions .btn {
  min-width: 70px;
}

.settings-page {
  width: min(1040px, 100%);
  min-height: min(720px, 100vh - 92px);
  margin-inline: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg2);
  overflow: hidden;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
}

.settings-sidebar {
  width: 244px;
  padding: 28px 12px;
  border-right: 1px solid color-mix(in srgb, var(--line), transparent 20%);
  background: color-mix(in srgb, var(--bg2), var(--bg3) 20%);
}

.settings-nav-label {
  padding: 0 10px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.settings-nav-separator {
  height: 1px;
  margin: 10px 8px;
  background: var(--line);
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 43px;
  padding: 9px 11px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: color 0.14s, background 0.14s, transform 0.14s;
}

.settings-tab:hover {
  transform: translateX(2px);
  text-decoration: none;
}

.settings-tab.active {
  border-left-color: var(--accent);
  background: rgba(88, 101, 242, 0.14);
  color: var(--text1);
}

.settings-tab-icon {
  width: 18px;
  color: var(--muted);
  text-align: center;
}

.settings-tab.active .settings-tab-icon {
  color: var(--accent);
}

.settings-content {
  padding: 0;
  background: var(--bg3);
}

.settings-content-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 96px;
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg3), var(--accent) 4%);
}

.settings-content-top h1 {
  margin: 2px 0 0;
  color: var(--text1);
  font-size: 24px;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.settings-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px 6px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text2);
  background: var(--bg2);
  font-size: 13px;
}

.settings-user-chip .avatar {
  width: 28px;
  height: 28px;
}

.settings-content-inner {
  padding: 30px 32px 42px;
}

.settings-card {
  width: min(780px, 100%);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg2), var(--bg3) 10%);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.1);
}

.settings-panel {
  padding: 0 24px 8px;
}

.settings-card-head {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--line);
}

.settings-card-head h2 {
  margin: 0;
  color: var(--text1);
  font-size: 22px;
}

.settings-card-head p {
  margin: 4px 0 0;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 86px;
  padding: 18px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line), transparent 28%);
}

.setting-copy {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.setting-icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 68%);
  border-radius: 10px;
  color: #aeb5ff;
  background: rgba(88, 101, 242, 0.1);
  font-size: 16px;
}

.settings-switch {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  outline-offset: 3px;
  background: var(--hover);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: background 0.16s ease;
}

.settings-switch.active {
  background: var(--ok);
}

.settings-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.16s ease;
}

.settings-switch.active .settings-switch-knob {
  transform: translateX(20px);
}

.settings-action {
  min-width: 130px;
}

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

.setting-row b, .setting-row small {
  display: block;
}

.setting-row small {
  margin-top: 3px;
  line-height: 1.35;
}

.setting-row-stack {
  align-items: flex-start;
  flex-direction: column;
  gap: 12px;
}

.setting-row-stack select {
  width: min(280px, 100%);
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented-control .btn {
  min-width: 112px;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 22px 0 14px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--danger), transparent 48%);
  border-radius: 8px;
  background: rgba(218, 55, 60, 0.055);
}

.danger-zone p {
  margin: 3px 0 0;
}

[data-density=compact] .side .row {
  padding-block: 4px;
}

[data-density=compact] .dm-row {
  min-height: 48px;
}

[data-density=compact] .messages {
  padding-top: 8px;
}

[data-density=compact] .msg {
  padding-block: 2px;
}

[data-density=compact] .content {
  --page-pad: 12px;
}

[data-reduce-motion=true] *, [data-reduce-motion=true] *::before, [data-reduce-motion=true] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 0.01ms !important;
}

@media (max-width: 760px) {
  .friends-page {
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .friends-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding-inline: 4px;
  }
  .friends-toolbar h2 {
    border: 0;
    padding: 0;
  }
  .friends-tabs {
    width: 100%;
    padding-bottom: 4px;
  }
  .friends-content {
    min-height: 0;
    padding: 14px 0;
    background: transparent;
  }
  .add-friend-form {
    align-items: stretch;
    flex-direction: column;
    padding: 10px;
  }
  .add-friend-search-icon {
    display: none;
  }
  .add-friend-form input {
    width: 100%;
    padding-inline: 8px;
  }
  .add-friend-form .btn {
    width: 100%;
  }
  .forum-directory-hero {
    padding: 18px 16px;
  }
  .friend-actions {
    width: 100%;
    margin: 8px 0 0 50px;
  }
  .friend-row {
    flex-wrap: wrap;
  }
  .friend-actions .btn {
    flex: 1 1 90px;
  }
  .settings-page {
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .settings-nav-label, .settings-nav-separator {
    display: none;
  }
  .settings-sidebar {
    width: auto;
    padding-inline: 0;
  }
  .settings-content {
    padding: 12px 0 0;
    background: transparent;
  }
  .settings-content-top {
    padding: 18px 4px;
  }
  .settings-user-chip {
    display: none;
  }
  .settings-content-inner {
    padding: 18px 0 32px;
  }
  .settings-panel {
    padding-inline: 16px;
  }
  .setting-row {
    gap: 14px;
  }
  .danger-zone {
    align-items: flex-start;
    flex-direction: column;
  }
}
.profile-identity {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.presence-text {
  font-weight: 550;
}

.presence-text.online {
  color: var(--ok);
}

.presence-text.away {
  color: #e6a23c;
}

.presence-text.busy {
  color: #ed4245;
}

.presence-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-transform: capitalize;
}

.presence-pill .status-dot {
  width: 8px;
  height: 8px;
}

.presence-pill.online {
  border-color: color-mix(in srgb, var(--ok), transparent 55%);
}

.presence-pill.away {
  border-color: color-mix(in srgb, #e6a23c, transparent 55%);
}

.presence-pill.busy {
  border-color: color-mix(in srgb, #ed4245, transparent 55%);
}

.list-section-title {
  margin: 18px 2px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.friend-request-section + .friend-request-section {
  margin-top: 6px;
}

.request-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 18px;
}

.request-actions .btn {
  min-width: 74px;
}

.message-request-row {
  min-height: 68px;
  padding: 10px 12px;
}

.message-requests-nav {
  margin-block: 5px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 72%);
}

.message-requests-nav .server-icon {
  width: 32px;
  height: 32px;
  color: #fff;
  background: var(--accent);
}

.notifications-page {
  width: min(1040px, 100%);
  margin-inline: auto;
}

.notifications-head {
  margin-bottom: 14px;
}

.notifications-head h2 {
  margin: 0;
  color: var(--text1);
}

.notifications-head p {
  margin: 3px 0 0;
}

.notifications-list {
  padding: 6px;
}

.notifications-list .notif {
  min-height: 68px;
  padding: 11px 13px;
  gap: 24px;
  border-radius: 8px;
}

.notifications-list .notif + .notif {
  margin-top: 3px;
}

.notifications-list .notif.unseen {
  background: rgba(88, 101, 242, 0.07);
}

.notifications-list .notif b {
  color: var(--text1);
  text-transform: capitalize;
}

.notif-time {
  flex-shrink: 0;
  padding-left: 16px;
  font-size: 12px;
}

.side .list > .row {
  margin-bottom: 3px;
}

@media (max-width: 760px) {
  .request-actions {
    width: 100%;
    margin: 8px 0 0 50px;
  }
  .message-request-row {
    flex-wrap: wrap;
  }
  .request-actions .btn {
    flex: 1;
  }
  .notifications-list .notif {
    align-items: flex-start;
    gap: 10px;
  }
  .notif-time {
    padding-left: 0;
  }
}
.channel-group-title.clickable {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.channel-group-title.clickable:hover {
  color: var(--text2);
}

.category-actions {
  margin-left: auto;
}
.category-actions .ctx-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.category-actions .ctx-trigger:hover {
  background: var(--hover);
  color: var(--text);
}

.category-empty {
  padding: 5px 12px 8px 31px;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.channel-category-select {
  width: 92px;
  min-width: 72px;
  max-width: 92px;
  height: 26px;
  padding: 2px 5px;
  border-color: transparent;
  color: var(--muted);
  background-color: transparent;
  font-size: 10px;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.channel-category-select:hover, .channel-category-select:focus {
  border-color: var(--line);
  color: var(--text2);
  background: var(--bg3);
  opacity: 1;
}

.category-modal-actions .grow {
  min-width: 8px;
}

.voice-participant.screen-sharing {
  border-color: var(--accent);
  background: rgba(88, 101, 242, 0.06);
}

.voice-card .voice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.voice-card .voice-header h2 {
  margin: 0;
}

.voice-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ok);
  background: rgba(35, 165, 90, 0.12);
  white-space: nowrap;
}

.primary-join {
  background: var(--accent) !important;
  color: #fff !important;
  font-weight: 600;
}
.primary-join:hover {
  background: var(--accent2) !important;
}

.share-btn {
  background: rgba(88, 101, 242, 0.1) !important;
  color: var(--accent) !important;
  border: 1px solid rgba(88, 101, 242, 0.3) !important;
  font-weight: 600;
}
.share-btn:hover {
  background: rgba(88, 101, 242, 0.18) !important;
}

.share-active {
  background: rgba(218, 55, 60, 0.1) !important;
  color: var(--danger) !important;
  border: 1px solid rgba(218, 55, 60, 0.3) !important;
  font-weight: 600;
}
.share-active:hover {
  background: rgba(218, 55, 60, 0.18) !important;
}

.voice-screen-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: rgba(88, 101, 242, 0.08);
  border: 1px solid rgba(88, 101, 242, 0.18);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}

.screen-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.7);
  }
}
.voice-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 14px;
}

.voice-actions .btn {
  transition: background 0.1s, transform 0.05s;
}
.voice-actions .btn:active {
  transform: scale(0.97);
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  z-index: 200;
  max-width: 380px;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  animation: toast-in 0.25s ease;
}

.toast-text {
  flex: 1;
}

.toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: var(--hover);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.toast-close:hover {
  background: var(--active);
  color: var(--text);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.pw-float {
  transition: box-shadow 0.15s;
}
.pw-float:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}
.pw-float video {
  pointer-events: none;
}

:root, [data-theme=dark] {
  --bg: #25272d;
  --bg2: #202228;
  --bg3: #17191e;
  --bg4: #101216;
  --hover: #343740;
  --active: #3c404b;
  --line: rgba(255,255,255,.09);
  --line2: rgba(255,255,255,.055);
  --radius: 9px;
  --radius-lg: 16px;
  --shadow: 0 18px 50px rgba(0,0,0,.38);
}

[data-theme=light] {
  --bg: #f6f7fa;
  --bg2: #eef0f5;
  --bg3: #e7e9f0;
  --bg4: #dfe2ea;
  --line: rgba(25,28,38,.11);
  --line2: rgba(25,28,38,.07);
}

.rail {
  padding-block: 14px;
  scrollbar-width: none;
  border-right: 1px solid var(--line2);
}
.rail::-webkit-scrollbar {
  display: none;
}

.rail-btn, .mark {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.side {
  background: color-mix(in srgb, var(--bg), var(--bg3) 18%);
  box-shadow: 7px 0 24px rgba(0, 0, 0, 0.06);
}

.side-head {
  min-height: var(--header-h);
  padding: 13px 16px;
  background: color-mix(in srgb, var(--bg), transparent 4%);
}

.msg {
  content-visibility: auto;
  contain-intrinsic-size: auto 74px;
}

#messages {
  overscroll-behavior: contain;
  overflow-anchor: auto;
  scrollbar-gutter: stable;
}

.media-attachment {
  width: min(560px, 100%);
  margin: 8px 0 4px;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg2);
  box-shadow: inset 0 0 0 1px var(--line2), 0 8px 24px rgba(0, 0, 0, 0.12);
}

.pw-audio-player {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto 92px;
  align-items: center;
  gap: 12px;
  padding: 11px;
  overflow: visible;
  background: var(--bg2);
}

.pw-audio-element {
  display: none;
}

.pw-media-play, .pw-media-mute, .pw-media-fullscreen, .pw-video-center-play {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease, opacity 0.14s ease;
}
.pw-media-play:hover, .pw-media-mute:hover, .pw-media-fullscreen:hover, .pw-video-center-play:hover {
  background: color-mix(in srgb, var(--accent), #fff 8%);
  transform: translateY(-1px);
}
.pw-media-play:active, .pw-media-mute:active, .pw-media-fullscreen:active, .pw-video-center-play:active {
  transform: translateY(0) scale(0.98);
}
.pw-media-play:focus-visible, .pw-media-mute:focus-visible, .pw-media-fullscreen:focus-visible, .pw-video-center-play:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent), #fff 32%);
  outline-offset: 2px;
}

.pw-audio-player > .pw-media-play {
  width: 56px;
  height: 44px;
  padding: 0;
}

.pw-media-copy {
  min-width: 0;
}

.pw-media-heading {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
}

.pw-media-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text1);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pw-media-download {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none !important;
}

.pw-media-download:hover {
  color: var(--text1);
}

.pw-media-timeline {
  display: grid;
  grid-template-columns: 36px minmax(80px, 1fr) 40px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.pw-media-time, .pw-media-duration {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pw-media-seek, .pw-media-volume {
  width: 100%;
  height: 20px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}

.pw-media-seek::-webkit-slider-runnable-track, .pw-media-volume::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 3px;
  background: var(--hover);
}

.pw-media-seek::-moz-range-track, .pw-media-volume::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 3px;
  background: var(--hover);
}

.pw-media-seek::-webkit-slider-thumb, .pw-media-volume::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: -4.5px;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--bg2);
  border-radius: 50%;
  background: var(--text1);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
}

.pw-media-seek::-moz-range-thumb, .pw-media-volume::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 2px solid var(--bg2);
  border-radius: 50%;
  background: var(--text1);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
}

.pw-media-seek:focus-visible, .pw-media-volume:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 6px;
}

.pw-media-mute, .pw-media-fullscreen {
  min-width: 58px;
  color: var(--text2);
  background: var(--hover);
}

.pw-media-mute:hover, .pw-media-fullscreen:hover {
  color: var(--text1);
  background: var(--active);
}

.pw-audio-player.media-error {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger), transparent 35%);
  opacity: 0.75;
}

.pw-video-player {
  background: #090a0d;
}

.pw-video-frame {
  position: relative;
  background: #050608;
}

.message-video {
  display: block;
  width: 100%;
  max-height: min(68vh, 620px);
  background: #050608;
  object-fit: contain;
}

.pw-video-center-play {
  position: absolute;
  left: 18px;
  bottom: 18px;
  min-width: 70px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
}

.pw-video-player.playing .pw-video-center-play {
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
}

.pw-video-controls {
  display: grid;
  grid-template-columns: auto auto minmax(90px, 1fr) auto auto 82px auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: #b9bec8;
  background: #14161b;
  font-size: 11px;
}

.pw-video-controls .compact {
  min-width: 48px;
  min-height: 32px;
  padding-inline: 9px;
}

.pw-video-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 12px 10px;
  color: #c9ccd3;
  background: #14161b;
  font-size: 12px;
}

.pw-video-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pw-video-meta a {
  color: #aeb4c0;
  text-decoration: none;
}

.pw-video-meta a:hover {
  color: #fff;
}

.voice-settings select {
  width: min(420px, 100%);
  min-height: 42px;
  padding: 8px 36px 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text1);
  background: var(--bg3);
}

.setting-row-stack {
  align-items: stretch;
  flex-direction: column;
  gap: 10px;
}

.setting-row-stack > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.voice-mode {
  display: flex;
  min-height: 94px;
  padding: 13px;
  border: 0;
  border-radius: 10px;
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
  color: var(--text2);
  background: var(--bg3);
  box-shadow: inset 0 0 0 1px var(--line2);
  text-align: left;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.voice-mode:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--hover);
}

.voice-mode.active {
  color: var(--text1);
  background: color-mix(in srgb, var(--bg3), var(--accent) 12%);
  box-shadow: inset 3px 0 var(--accent);
}

.voice-mode:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.voice-mode-title {
  color: var(--text1);
  font-size: 13px;
  font-weight: 750;
}

.voice-mode-copy {
  font-size: 11px;
  line-height: 1.45;
}

.mic-test-card {
  padding-block: 20px;
}

.mic-meter {
  position: relative;
  width: min(520px, 100%);
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: var(--bg3);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.24);
}

.mic-meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ok);
  transition: width 70ms linear;
}

.mic-meter-peak {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 82%;
  width: 1px;
  background: rgba(255, 255, 255, 0.6);
}

.mic-test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mic-test-actions .active {
  color: #fff;
  background: var(--accent);
}

.mic-monitor-warning {
  color: #e9bd64;
  font-size: 11px;
}

.voice-settings-note {
  margin: 18px 0 12px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 65%);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent), transparent 91%);
}

.voice-settings-note p {
  margin: 4px 0 0;
}

.call-bar.compact, .call-overlay.expanded, .call-popup {
  border-color: rgba(255, 255, 255, 0.11);
  background: color-mix(in srgb, var(--bg4), var(--accent) 4%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58), inset 0 1px rgba(255, 255, 255, 0.04);
}

.call-bar.compact, .call-overlay-header, .call-popup-head {
  cursor: grab;
  touch-action: none;
}

.call-bar.compact:active, .call-overlay-header:active, .call-popup-head:active {
  cursor: grabbing;
}

.call-overlay-controls .btn, .call-popup-actions .btn {
  min-height: 38px;
  border-radius: 10px;
}

.pw-float {
  min-width: 180px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  background: #06070a;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58);
  touch-action: none;
  will-change: left, top, width;
}
.pw-float .pw-float-bar {
  min-height: 34px !important;
  padding-inline: 10px !important;
}
.pw-float video {
  border-radius: 0 0 11px 11px !important;
}

.settings-page {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg3);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.1);
}

.settings-sidebar {
  border-right: 1px solid var(--line);
}

.settings-card {
  border-color: var(--line);
}

.settings-tab {
  border-radius: 0 9px 9px 0;
}

.settings-tab.active {
  box-shadow: inset 3px 0 var(--accent);
}

.server-hero {
  --server-accent: var(--accent);
  position: relative;
  min-height: 170px;
  align-items: flex-end;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--server-accent), transparent 58%);
  background-color: var(--bg2);
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 -4px 0 var(--server-accent), 0 16px 40px rgba(0, 0, 0, 0.16);
}

.server-hero > * {
  position: relative;
  z-index: 1;
}

.server-hero .server-icon {
  width: 64px;
  height: 64px;
  border: 3px solid color-mix(in srgb, var(--server-accent), #fff 16%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.server-hero h2 {
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

.server-hero p {
  color: rgba(255, 255, 255, 0.78) !important;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}

.server-hero-actions {
  margin-left: auto;
}

.server-hero-actions .btn:first-child {
  border-color: var(--server-accent);
  background: var(--server-accent);
}

.server-color-control {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.server-color-control input[type=color] {
  width: 48px;
  height: 42px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg3);
  cursor: pointer;
}

@media (max-width: 760px) {
  :root {
    --rail-w: 58px;
    --side-w: min(86vw, 320px);
  }
  .rail {
    padding-block: 8px;
  }
  .rail-btn, .mark, .rail-btn .server-icon {
    width: 42px;
    height: 42px;
  }
  .content, .main {
    min-width: 0;
  }
  .content-head {
    padding-inline: 12px;
  }
  .msg {
    content-visibility: visible;
    contain-intrinsic-size: none;
  }
  .pw-audio-player {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px;
  }
  .pw-audio-player > .pw-media-volume {
    display: none;
  }
  .pw-media-timeline {
    grid-template-columns: 34px minmax(54px, 1fr) 38px;
    gap: 4px;
  }
  .pw-video-controls {
    grid-template-columns: auto auto minmax(58px, 1fr) auto auto auto;
    gap: 5px;
  }
  .pw-video-controls .pw-media-volume {
    display: none;
  }
  .voice-mode-grid {
    grid-template-columns: 1fr;
  }
  .voice-mode {
    min-height: 72px;
  }
  .media-attachment {
    width: 100%;
    max-width: calc(100vw - 74px);
  }
  .call-layer {
    right: 8px;
    bottom: max(68px, env(safe-area-inset-bottom) + 58px);
    left: 8px;
  }
  .call-bar.compact, .call-overlay.expanded, .call-popup {
    width: 100%;
    max-height: calc(100dvh - 92px);
  }
  .call-overlay.expanded {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .call-bar.compact, .call-overlay-header, .call-popup-head {
    cursor: default;
    touch-action: auto;
  }
  .pw-float {
    max-width: calc(100vw - 12px) !important;
    max-height: calc(100dvh - 74px) !important;
  }
  .settings-page {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .settings-content-inner {
    padding-bottom: max(88px, env(safe-area-inset-bottom) + 72px);
  }
}
@media (max-width: 430px) {
  .media-attachment {
    max-width: calc(100vw - 50px);
  }
  .pw-audio-player {
    grid-template-columns: 48px minmax(0, 1fr) auto;
  }
  .pw-audio-player > .pw-media-play {
    width: 48px;
    height: 40px;
  }
  .pw-media-heading {
    gap: 6px;
  }
  .pw-video-controls {
    grid-template-columns: auto auto minmax(48px, 1fr) auto auto;
  }
  .pw-video-controls .pw-media-duration {
    display: none;
  }
  .pw-video-meta {
    align-items: flex-start;
  }
  .dm-call-bar {
    padding-inline: 10px;
  }
  .dm-call-bar-controls {
    width: 100%;
    justify-content: stretch;
  }
  .dm-call-bar-controls .btn {
    flex: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* forms that don't ask normal humans for database ids */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.choice-grid.two, .appearance-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.appearance-choice-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 20px;
  min-height: 72px;
  padding: 11px 12px;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text2);
  background: var(--bg3);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.choice-card:hover {
  color: var(--text1);
  background: var(--hover);
  transform: translateY(-1px);
}

.choice-card.selected {
  border-color: color-mix(in srgb, var(--accent), transparent 35%);
  color: var(--text1);
  background: color-mix(in srgb, var(--bg3), var(--accent) 10%);
}

.choice-card-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 9px;
  color: var(--text1);
  background: var(--bg2);
  font-size: 17px;
  font-weight: 750;
}

.choice-card.selected .choice-card-icon {
  color: #fff;
  background: var(--accent);
}

.choice-card-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.choice-card-copy b {
  font-size: 13px;
}

.choice-card-copy small {
  line-height: 1.35;
}

.choice-card-check {
  color: var(--accent);
  font-weight: 800;
  text-align: center;
}

.invite-destination-grid {
  max-height: 240px;
  padding-right: 3px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.segmented-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.choice-pill {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text2);
  background: var(--bg3);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.choice-pill:hover {
  color: var(--text1);
  background: var(--hover);
}

.choice-pill.selected {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.accent-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.accent-swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.accent-swatch:hover {
  transform: scale(1.06);
}

.accent-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent);
}

.category-preview {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  padding: 12px;
  align-items: center;
  gap: 8px;
  border-radius: 9px;
  color: var(--text2);
  background: var(--bg3);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.server-create-page {
  display: grid;
  width: min(920px, 100%);
  margin: 0 auto;
  grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.server-create-intro, .server-create-form {
  padding: clamp(24px, 4vw, 42px);
  border-radius: 16px;
}

.server-create-intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--bg2);
}

.server-create-intro h1 {
  margin: 6px 0 8px;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.04em;
}

.server-create-intro > p {
  max-width: 48ch;
  line-height: 1.6;
}

.server-create-mark {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--accent);
  font-size: 27px;
}

.server-create-preview {
  display: flex;
  margin-top: 28px;
  padding: 13px;
  align-items: center;
  gap: 11px;
  border-radius: 11px;
  background: var(--bg3);
}

.server-create-preview > div:last-child, .server-create-defaults span {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.server-create-preview small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-create-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--bg2);
}

.server-create-defaults {
  display: grid;
  margin: 8px 0 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.server-create-defaults > div {
  display: flex;
  padding: 11px;
  align-items: center;
  gap: 9px;
  border-radius: 10px;
  background: var(--bg3);
}

.server-default-icon {
  display: grid !important;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--bg2);
  font-weight: 800;
}

.server-create-actions {
  margin-top: 0;
  padding-inline: 0;
  padding-bottom: 0;
}

.notification-sound-preview {
  display: flex;
  padding: 16px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
}

.notification-sound-preview > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.call-user-status.reconnecting, .voice-state-pill.reconnecting {
  color: #e9bd64;
}

/* blur made chat scrolling sad */
.chat-header, .chat-status, .topbar, .mobile-nav, .call-popup, .call-bar.compact, .call-overlay.expanded {
  backdrop-filter: none;
}

.call-bar.compact {
  transition: border-color 0.14s ease, transform 0.14s ease, background 0.14s ease;
}

.pw-float {
  will-change: auto;
}

.pw-float:active {
  will-change: transform, width;
}

@media (max-width: 760px) {
  .choice-grid.two, .appearance-choice-grid {
    grid-template-columns: 1fr;
  }
  .server-create-page {
    grid-template-columns: 1fr;
  }
  .server-create-intro, .server-create-form {
    padding: 22px 18px;
    border-radius: 12px;
  }
  .server-create-intro > p {
    margin-bottom: 0;
  }
  .notification-sound-preview {
    align-items: stretch;
    flex-direction: column;
  }
}
/* Rich link previews. The card stays deliberately flat and readable. */
.message-link {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.link-embed-wrap {
  display: grid;
  gap: 6px;
  width: min(520px, 100%);
  margin-top: 8px;
}

.link-embed {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--bg2);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
}
.link-embed:hover {
  background: var(--hover);
  text-decoration: none;
}
.link-embed .link-embed-site {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}
.link-embed .link-embed-title {
  color: var(--text1);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.link-embed .link-embed-description {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.link-embed img {
  display: block;
  width: 100%;
  max-height: 280px;
  margin-top: 4px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--bg3);
}

/* Floating screen share windows. */
.pw-float {
  position: fixed;
  display: none;
  min-width: 220px;
  min-height: 160px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #000;
  box-shadow: var(--shadow);
  resize: both;
  contain: layout paint;
}

.pw-float-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 7px 5px 10px;
  background: var(--bg3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.pw-float-title {
  flex: 1;
  min-width: 0;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pw-float-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  line-height: 1;
}
.pw-float-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.pw-float-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.pw-float video {
  display: block;
  width: 100%;
  height: calc(100% - 34px);
  min-height: 120px;
  background: #000;
  object-fit: contain;
}

@media (max-width: 620px) {
  .link-embed-wrap {
    width: 100%;
  }
  .link-embed img {
    max-height: 210px;
  }
  .pw-float {
    min-width: 180px;
    min-height: 130px;
  }
}
[data-density=compact] .link-embed {
  padding: 8px 10px;
}

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

/* Product shell polish */
.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  background: var(--bg1);
  color: var(--text1);
}

.auth-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 42px;
  min-height: 100dvh;
  padding: clamp(32px, 5vw, 72px);
  overflow: hidden;
  background: var(--bg3);
  border-right: 1px solid var(--line);
}

.auth-brand-panel::after {
  display: none;
}

.auth-brand-lockup,
.auth-mobile-brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.auth-brand-mark {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background-color: #fff;
  box-shadow: var(--shadow-sm);
}

.auth-brand-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.auth-brand-copy h1 {
  max-width: 14ch;
  margin: 12px 0 16px;
  font-size: clamp(38px, 4.2vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.auth-brand-copy > p {
  max-width: 56ch;
  margin: 0;
  color: var(--text2);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.58;
}

.auth-feature-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.auth-feature {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg2), transparent 16%);
}

.auth-feature b,
.auth-feature span {
  display: block;
}

.auth-feature b {
  margin-bottom: 5px;
  font-size: 13px;
}

.auth-feature span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.auth-form-panel {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(24px, 6vw, 92px);
}

.auth-form-wrap {
  width: min(430px, 100%);
}

.auth-mobile-brand {
  display: none;
  margin-bottom: 28px;
}

.auth-heading {
  margin-bottom: 22px;
}

.auth-heading h2 {
  margin: 0 0 7px;
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: -0.025em;
}

.auth-heading p {
  margin: 0;
  line-height: 1.5;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
}

.auth-mode-btn {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.auth-mode-btn:hover {
  color: var(--text1);
  background: var(--hover);
}

.auth-mode-btn.active {
  color: var(--text1);
  background: var(--bg4);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
}

.auth-fields {
  display: grid;
  gap: 14px;
}

.auth-fields .field {
  margin: 0;
}

.auth-fields label {
  font-weight: 700;
  font-size: 13px;
}

.auth-fields input {
  min-height: 45px;
}

.auth-submit {
  width: 100%;
  min-height: 45px;
  margin-top: 2px;
  font-weight: 800;
}

.auth-password-meter {
  display: grid;
  gap: 7px;
  margin-top: -5px;
}

.auth-password-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.auth-password-bar::after {
  content: "";
  display: block;
  height: 100%;
  width: 28%;
  border-radius: inherit;
  background: #c65358;
  transition: width 0.15s ease;
}

.auth-password-bar.strength-medium::after {
  width: 62%;
  background: #a87822;
}

.auth-password-bar.strength-strong::after {
  width: 100%;
  background: #3d8f59;
}

.auth-error {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, #d34f55, transparent 55%);
  border-radius: 9px;
  background: color-mix(in srgb, #d34f55, transparent 90%);
}

.auth-footnote {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.account-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.settings-action-card {
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  color: var(--text1);
  text-align: left;
  cursor: pointer;
}

.settings-action-card:hover {
  background: var(--hover);
  border-color: color-mix(in srgb, var(--accent), var(--line) 58%);
}

.settings-action-card b {
  font-size: 13px;
}

.settings-action-card small {
  line-height: 1.45;
}

.account-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(3px);
}

.account-dialog {
  width: min(520px, 100%);
  max-height: min(720px, 100dvh - 36px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg2);
  color: var(--text1);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.account-dialog-head,
.account-dialog-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 17px;
}

.account-dialog-head {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.account-dialog-head h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.account-dialog-head p {
  margin: 0;
  font-size: 12px;
}

.account-dialog-body {
  max-height: 480px;
  overflow: auto;
  padding: 17px;
}

.account-dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.account-password-fields {
  display: grid;
  gap: 13px;
}

.account-password-fields .field {
  margin: 0;
}

.account-dialog-status {
  min-height: 18px;
  color: #e36a70;
  font-size: 12px;
}

.session-list {
  display: grid;
  gap: 8px;
}

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg1);
}

.session-row b, .session-row small {
  display: block;
}

.session-row small {
  margin-top: 3px;
}

[data-compact-messages=true] .msg {
  padding-top: 2px;
  padding-bottom: 2px;
}

[data-animated-media=false] .message-image[src$=".gif" i] {
  visibility: hidden;
}

[data-animated-media=false] .message-image-link:has(.message-image[src$=".gif" i])::after {
  content: "Animated image paused";
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--bg2);
}

@media (max-width: 920px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-brand-panel {
    display: none;
  }
  .auth-form-panel {
    min-height: 100dvh;
    padding: 30px 20px;
  }
  .auth-mobile-brand {
    display: inline-flex;
  }
}
@media (max-width: 620px) {
  .account-action-grid {
    grid-template-columns: 1fr;
  }
  .account-dialog-actions {
    flex-wrap: wrap;
  }
  .account-dialog-actions .btn {
    flex: 1 1 auto;
  }
}
/* Plainwire 1.4.0: release UI and mobile pass */
:root,
[data-theme=light] {
  color-scheme: light;
  --radius: 8px;
  --radius-lg: 14px;
  --header-h: 60px;
  --side-w: 268px;
  --right-w: 260px;
}

[data-theme=dark] {
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]):not([data-theme=dark]) {
    color-scheme: dark;
  }
}
html,
body {
  background: var(--bg4);
}

.layout {
  gap: 10px;
  padding: 10px;
}

.rail,
.side,
.main,
.right,
.settings-page {
  border-color: color-mix(in srgb, var(--line), transparent 12%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.rail {
  width: 64px;
  gap: 7px;
  padding: 10px 0;
  border-radius: 18px;
  background: var(--bg3);
}

.mark {
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  border: 1px solid color-mix(in srgb, var(--accent), #fff 12%);
  border-radius: 13px;
  background: var(--accent);
  box-shadow: none;
}

.mark::after {
  font-size: 16px;
  font-weight: 800;
}

.rail-btn {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  font-size: 17px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.rail-glyph {
  display: grid;
  min-width: 20px;
  place-items: center;
  line-height: 1;
  font-size: 18px;
  font-weight: 700;
}

.rail-btn:hover {
  transform: none;
  background: var(--hover);
  color: var(--text1);
  box-shadow: none;
}

.rail-btn.active {
  transform: none;
  background: color-mix(in srgb, var(--accent), transparent 84%);
  color: color-mix(in srgb, var(--accent), #fff 20%);
  box-shadow: none;
}

.rail-btn::before {
  left: -1px;
  background: var(--accent);
}

.rail-btn .server-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.side,
.right {
  border-radius: 18px;
  background: var(--bg2);
}

.side-head {
  min-height: auto;
  padding: 18px 16px 14px;
  background: transparent;
}

.side-head h1 {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.side-head small {
  max-width: 28ch;
  font-size: 12px;
  line-height: 1.45;
}

.side-head .nav-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.side-head .nav-actions .btn {
  width: 100%;
  min-width: 0;
  padding-inline: 8px;
}

.search {
  padding: 10px 12px 12px;
}

#globalSearch {
  min-height: 40px;
  border-radius: 10px;
  background: var(--bg3);
}

.side .list,
.right .list {
  padding: 7px;
}

.row {
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 11px;
}

.row:hover,
.row.active {
  border-color: transparent;
}

.dm-row {
  min-height: 58px;
}

.dm-row.active {
  box-shadow: inset 2px 0 0 var(--accent);
}

.user-panel {
  min-height: 62px;
  background: var(--bg3);
}

.main {
  border-radius: 18px;
  background: var(--bg);
}

.topbar {
  height: var(--header-h);
  min-height: var(--header-h);
  padding: 0 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  background: var(--bg);
}

.topbar h2 {
  font-size: 18px;
}

.content {
  padding: 22px;
  background: var(--bg);
}

.btn {
  border-radius: 9px;
  font-weight: 650;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn:active {
  transform: none;
}

.btn:not(.secondary):not(.ghost):not(.danger):not(.call-decline):not(.call-accept):not(.icon-btn):not(.chat-call-action) {
  background: var(--accent);
  box-shadow: none;
}

.btn:not(.secondary):not(.ghost):not(.danger):not(.call-decline):not(.call-accept):not(.icon-btn):not(.chat-call-action):hover {
  background: var(--accent2);
}

.card,
.stat-card,
.forum-card,
.forum-thread,
.settings-card,
.group-members,
.server-create-form,
.server-create-intro,
.chat-surface,
.voice-participant,
.thread-post,
.thread-page > .composer {
  border-radius: 14px;
  box-shadow: none;
}

/* Home is an application dashboard, not a marketing landing page. */
.home-dashboard {
  gap: 14px;
}

.home-welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 4px 18px;
  border-bottom: 1px solid var(--line);
}

.home-welcome-copy h1 {
  margin: 4px 0 5px;
  color: var(--text1);
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.home-welcome-copy p {
  max-width: 62ch;
  margin: 0;
  color: var(--text2);
  line-height: 1.55;
}

.home-primary-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.home-stat-grid {
  gap: 10px;
}

.stat-card {
  min-height: 100px;
  padding: 15px 16px;
  border-color: var(--line);
  background: var(--bg2);
}

.stat-card:hover {
  transform: none;
  border-color: color-mix(in srgb, var(--accent), var(--line) 58%);
  background: var(--hover);
}

.stat-value {
  margin-bottom: 7px;
  font-size: 29px;
}

.home-columns {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 12px;
}

.home-panel {
  min-height: 300px;
}

.home-panel .section-head h2 {
  font-size: 18px;
}

.home-panel .section-head p {
  font-size: 12px;
}

.home-recent-list .dm-row {
  margin-bottom: 2px;
}

.home-empty {
  min-height: 140px;
  display: grid;
  place-items: center;
  font-style: normal;
}

.home-activity {
  display: flex;
  min-height: 300px;
  flex-direction: column;
}

.home-activity-list {
  display: grid;
  gap: 2px;
}

.home-activity-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
  min-height: 54px;
  padding: 9px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.home-activity-row:hover {
  background: var(--hover-soft);
}

.home-activity-mark {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--line2);
}

.home-activity-row.unseen .home-activity-mark {
  background: var(--accent);
}

.home-activity-copy {
  min-width: 0;
}

.home-activity-copy b,
.home-activity-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-activity-copy b {
  color: var(--text1);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
}

.home-activity-copy small {
  margin-top: 3px;
  font-size: 11px;
  white-space: nowrap;
}

.home-quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* Auth stays restrained: strong type, flat surfaces, no glowing gradients. */
.auth-shell {
  background: var(--bg);
}

.auth-brand-panel {
  padding: clamp(34px, 5vw, 70px);
  background: var(--bg3);
}

.auth-brand-panel::after {
  display: none;
}

.auth-brand-copy h1 {
  max-width: 13ch;
  font-size: clamp(36px, 4vw, 62px);
  line-height: 1.01;
}

.auth-feature-grid {
  grid-template-columns: 1fr;
  gap: 0;
  max-width: 560px;
  border-top: 1px solid var(--line);
}

.auth-feature {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr);
  gap: 20px;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.auth-feature b {
  margin: 0;
}

.auth-form-panel {
  background: var(--bg);
}

.auth-form-wrap {
  width: min(440px, 100%);
}

.auth-mode-switch {
  border-radius: 9px;
  background: var(--bg2);
}

.auth-mode-btn {
  border-radius: 6px;
}

.auth-mode-btn.active {
  background: var(--bg3);
  box-shadow: inset 0 0 0 1px var(--line);
}

.auth-fields input {
  border-radius: 10px;
  background: var(--bg2);
}

.auth-password-field {
  position: relative;
}

.auth-password-field input {
  padding-right: 66px;
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  min-width: 50px;
  min-height: 32px;
  padding: 0 8px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.auth-password-toggle:hover {
  background: var(--hover);
  color: var(--text1);
}

.auth-submit {
  border-radius: 10px;
}

.auth-password-bar::after {
  background: #b94a51;
}

.auth-password-bar.strength-medium::after {
  background: #9c721f;
}

.auth-password-bar.strength-strong::after {
  background: #2f8050;
}

/* Messaging is flatter and calmer. */
.chat-surface {
  border-color: var(--line);
  background: var(--bg);
}

.chat-header,
.chat-status,
.join-call-banner,
.dm-call-bar {
  background: var(--bg);
}

.messages {
  background: var(--bg);
}

.msg {
  padding-block: 7px;
  border-radius: 9px;
}

.msg:hover,
.msg.mine:hover {
  background: var(--hover-soft);
}

.msg-actions {
  border-radius: 9px;
  background: var(--bg2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.composer {
  padding-top: 10px;
  background: var(--bg);
}

.composer textarea {
  border-radius: 12px;
  background: var(--bg2);
  box-shadow: none;
}

.composer textarea:focus {
  background: var(--bg2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 82%);
}

.link-embed,
.embed {
  border-left-width: 2px;
  border-radius: 11px;
  background: var(--bg2);
}

/* Settings */
.settings-mobile-nav {
  display: none;
}

.settings-page {
  grid-template-columns: 238px minmax(0, 1fr);
  border-radius: 18px;
}

.settings-sidebar {
  padding: 18px 0;
  background: var(--bg2);
}

.settings-tab {
  margin-inline: 10px;
  border-radius: 9px;
}

.settings-tab.active {
  background: color-mix(in srgb, var(--accent), transparent 88%);
  box-shadow: none;
}

.settings-content-top {
  min-height: 88px;
  padding: 20px 28px;
  background: var(--bg);
}

.settings-content-inner {
  padding: 24px 28px 32px;
}

.settings-card {
  width: min(860px, 100%);
  border-radius: 13px;
  background: var(--bg2);
}

.settings-panel {
  padding-inline: 22px;
}

.settings-action-card {
  border-radius: 10px;
  background: var(--bg3);
}

input[type=file] {
  min-height: 42px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg3);
  color: var(--muted);
}

input[type=file]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg2);
  color: var(--text1);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
}

input[type=file]::file-selector-button:hover {
  background: var(--hover);
}

/* Tablet layout */
@media (max-width: 1040px) and (min-width: 761px) {
  :root {
    --side-w: 238px;
  }
  .layout {
    gap: 8px;
    padding: 8px;
  }
  .content {
    padding: 18px;
  }
  .home-columns {
    grid-template-columns: 1fr;
  }
  .settings-page {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .settings-content-inner {
    padding-inline: 20px;
  }
}
/* Phone UI is intentionally its own layout instead of squeezed desktop. */
@media (max-width: 760px) {
  :root {
    --header-h: 56px;
    --side-w: min(90vw, 340px);
    --mobile-nav-h: 66px;
    --page-pad: 12px;
  }
  html,
  body,
  #app {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
  .layout {
    display: flex;
    height: 100dvh;
    padding: 0 0 calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
    gap: 0;
    background: var(--bg);
  }
  .rail,
  .right {
    display: none;
  }
  .main {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--bg);
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 35;
    height: calc(var(--header-h) + env(safe-area-inset-top));
    min-height: calc(var(--header-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    border-radius: 0;
    background: var(--bg);
  }
  .topbar h2 {
    font-size: 17px;
  }
  .sidebar-toggle {
    display: inline-grid;
    width: 42px;
    height: 42px;
    margin: 0;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg2);
    font-size: 19px;
  }
  .content {
    flex: 1;
    min-height: 0;
    padding: 14px 12px 18px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }
  .side {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    left: calc(-1 * var(--side-w) - 30px);
    z-index: 85;
    width: var(--side-w);
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0 18px 18px 0;
    box-shadow: 18px 0 48px rgba(0, 0, 0, 0.36);
    transition: left 0.18s ease;
  }
  .side.open {
    left: 0;
  }
  .drawer-overlay {
    z-index: 84;
    background: rgba(0, 0, 0, 0.54);
  }
  .side-head {
    padding: calc(18px + env(safe-area-inset-top)) 14px 12px;
  }
  .side-head .nav-actions {
    grid-template-columns: 1fr 1fr;
  }
  .side .list {
    padding: 7px;
  }
  .row {
    min-height: 56px;
    border-radius: 12px;
  }
  .dm-row .avatar,
  .dm-row .presence-avatar .avatar {
    width: 42px;
    height: 42px;
  }
  .user-panel {
    min-height: 66px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    inset: auto 0 0;
    z-index: 70;
    height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
    padding: 5px max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
    gap: 2px;
    border-top: 1px solid var(--line);
    background: var(--bg2);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.14);
    backdrop-filter: none;
  }
  .mobile-nav button {
    width: 100%;
    min-width: 0;
    height: 54px;
    min-height: 54px;
    padding: 4px 1px;
    border-radius: 10px;
  }
  .mobile-nav button:hover {
    background: transparent;
  }
  .mobile-nav button.active {
    background: color-mix(in srgb, var(--accent), transparent 88%);
    color: var(--text1);
  }
  .mobile-nav-icon {
    font-size: 18px;
    font-weight: 700;
  }
  .mobile-nav-label {
    font-size: 10px;
    font-weight: 700;
  }
  .mobile-server-dots {
    display: none;
  }
  .servers-sheet {
    z-index: 100;
    background: rgba(0, 0, 0, 0.54);
  }
  .servers-sheet .servers-sheet-card {
    position: relative;
    max-height: 82dvh;
    padding: 26px 14px calc(14px + env(safe-area-inset-bottom));
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    background: var(--bg2);
  }
  .servers-sheet .servers-sheet-card::before,
  .modal-card::before,
  .action-modal::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 38px;
    height: 4px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: var(--line2);
  }
  .server-sheet-row {
    min-height: 58px;
    border-radius: 12px;
  }
  /* Mobile home */
  .home-dashboard {
    width: 100%;
    gap: 12px;
  }
  .home-welcome {
    display: block;
    padding: 6px 2px 16px;
  }
  .home-welcome-copy h1 {
    margin-top: 3px;
    font-size: clamp(25px, 8vw, 32px);
  }
  .home-welcome-copy p {
    font-size: 14px;
  }
  .home-primary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 14px;
  }
  .home-primary-actions .btn {
    width: 100%;
    min-height: 44px;
  }
  .home-stat-grid {
    display: flex;
    margin-inline: -12px;
    padding: 0 12px 4px;
    gap: 9px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .home-stat-grid::-webkit-scrollbar {
    display: none;
  }
  .home-stat-grid .stat-card {
    flex: 0 0 156px;
    min-height: 96px;
    scroll-snap-align: start;
  }
  .home-columns {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .home-panel {
    min-height: 0;
    border-radius: 13px;
  }
  .home-panel.card.pad {
    padding: 14px;
  }
  .home-recent-list .dm-row {
    margin-inline: -5px;
  }
  /* Chat becomes edge-to-edge on phones. */
  .chat-content {
    padding: 0;
    overflow: hidden;
  }
  .chat-content > .chat-surface,
  .chat-content > .chat-with-members {
    width: 100%;
    height: 100%;
    min-height: 0;
  }
  .chat-surface {
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    background: var(--bg);
    box-shadow: none;
  }
  .chat-header {
    position: relative;
    z-index: 3;
    min-height: 62px;
    padding: 9px 11px;
    gap: 9px;
    border-bottom: 1px solid var(--line);
  }
  .chat-header .avatar,
  .chat-header .presence-avatar .avatar {
    width: 40px;
    height: 40px;
  }
  .chat-header h2 {
    font-size: 15px;
  }
  .chat-header small {
    max-width: 48vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .chat-header .btn {
    width: auto;
    min-width: 48px;
    min-height: 38px;
    padding-inline: 10px;
    border-radius: 9px;
  }
  .chat-status {
    position: relative;
    margin: 0;
    padding: 7px 11px;
  }
  .messages {
    flex: 1;
    min-height: 0;
    padding: 10px 8px 8px;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }
  .msg {
    gap: 9px;
    margin: 0;
    padding: 7px 6px;
    border-radius: 9px;
  }
  .msg > .avatar,
  .msg > .presence-avatar .avatar,
  .msg .avatar-spacer {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }
  .msg-head {
    gap: 4px 7px;
  }
  .msg-name {
    font-size: 14px;
  }
  .msg-time {
    font-size: 10px;
  }
  .msg-body {
    font-size: 15px;
    line-height: 1.48;
  }
  .msg-actions {
    position: static;
    display: none;
    width: fit-content;
    margin-top: 5px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .msg:focus-within .msg-actions {
    display: flex;
  }
  .composer {
    position: relative;
    bottom: auto;
    z-index: 4;
    gap: 7px;
    padding: 8px 8px 10px;
    border-top: 1px solid var(--line);
    background: var(--bg);
  }
  .composer textarea {
    min-height: 48px;
    max-height: 112px;
    padding: 12px 13px;
    border-radius: 12px;
    font-size: 16px;
    resize: none;
  }
  .composer-footer {
    align-items: center;
    gap: 7px;
  }
  .composer-footer small {
    display: none;
  }
  .composer-footer .attach-btn {
    flex: 0 0 auto;
    min-width: 0;
  }
  .composer-footer .btn:last-child {
    min-width: 82px;
    margin-left: auto;
  }
  .reply-bar {
    border-radius: 10px;
  }
  .chat-with-members {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .chat-with-members .group-members {
    order: -1;
    max-height: 122px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
  }
  .group-members-head {
    display: none;
  }
  .group-members-list {
    max-height: 122px;
    padding: 7px;
  }
  /* Settings use one compact picker on phones instead of a buggy tab strip. */
  .settings-page {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .settings-sidebar {
    display: none;
  }
  .settings-mobile-nav {
    display: grid;
    gap: 6px;
    position: sticky;
    top: 0;
    z-index: 12;
    padding: 10px 0 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .settings-mobile-nav label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .settings-mobile-nav select {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--bg2);
    color: var(--text1);
    font-size: 16px;
    font-weight: 650;
  }
  .settings-content {
    padding: 0;
    background: transparent;
  }
  .settings-content-top {
    min-height: auto;
    padding: 18px 0 13px;
    border-bottom: 0;
    background: transparent;
  }
  .settings-content-top h1 {
    font-size: 25px;
  }
  .settings-user-chip {
    display: none;
  }
  .settings-content-inner {
    padding: 0 0 18px;
  }
  .settings-card {
    width: 100%;
    border-radius: 12px;
    background: var(--bg2);
  }
  .settings-panel {
    padding-inline: 14px;
  }
  .settings-card-head {
    padding: 18px 0 14px;
  }
  .settings-card-head h2 {
    font-size: 19px;
  }
  .setting-row {
    align-items: center;
    gap: 12px;
    padding: 14px 0;
  }
  .setting-row-stack {
    align-items: stretch;
  }
  .appearance-choice-grid,
  .voice-mode-grid,
  .account-action-grid {
    grid-template-columns: 1fr;
  }
  .choice-card,
  .settings-action-card,
  .voice-mode {
    min-height: 68px;
  }
  .settings-action {
    min-width: 92px;
  }
  .settings-banner {
    height: 128px;
    border-radius: 12px 12px 0 0;
  }
  .settings-fields {
    padding: 44px 13px 14px;
  }
  .file-upload-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
  }
  .file-upload-row input[type=file] {
    width: 100%;
    min-width: 0;
  }
  /* Bottom-sheet dialogs */
  .modal,
  .account-dialog-backdrop {
    padding: 10px 8px 0;
    place-items: end center;
    background: rgba(0, 0, 0, 0.56);
  }
  .modal-card,
  .action-modal,
  .account-dialog {
    position: relative;
    width: 100%;
    max-height: 88dvh;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.28);
  }
  .modal-head,
  .account-dialog-head {
    padding-top: 23px;
  }
  .modal-actions,
  .account-dialog-actions {
    position: sticky;
    bottom: 0;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    background: var(--bg2);
  }
  .modal-actions .btn,
  .account-dialog-actions .btn {
    min-height: 44px;
  }
  /* Calls and screen sharing stay inside the viewport on touch devices. */
  .call-layer {
    inset: auto 8px calc(var(--mobile-nav-h) + env(safe-area-inset-bottom) + 8px);
    max-height: calc(100dvh - var(--mobile-nav-h) - env(safe-area-inset-bottom) - 24px);
  }
  .call-popup,
  .call-bar.compact,
  .call-overlay.expanded {
    width: 100%;
    max-width: none;
    max-height: inherit;
    border-radius: 14px;
  }
  .call-overlay.expanded {
    overflow-y: auto;
  }
  .pw-float {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom) + 8px) !important;
    width: auto !important;
    height: min(48dvh, 360px) !important;
    min-width: 0;
    min-height: 180px;
    max-width: none !important;
    max-height: 56dvh !important;
    border-radius: 14px;
    resize: none;
  }
  .pw-float-bar {
    cursor: default;
    touch-action: auto;
  }
  /* Phone forms should not trigger browser zoom. */
  input,
  textarea,
  select {
    font-size: 16px;
  }
  .btn,
  .settings-action-card,
  .choice-card,
  .home-activity-row,
  .server-sheet-row {
    min-height: 44px;
  }
  /* Auth on phone */
  .auth-shell {
    display: block;
    min-height: 100dvh;
    overflow-y: auto;
  }
  .auth-brand-panel {
    display: none;
  }
  .auth-form-panel {
    display: block;
    min-height: 100dvh;
    padding: max(28px, env(safe-area-inset-top)) 18px max(30px, env(safe-area-inset-bottom));
  }
  .auth-form-wrap {
    width: min(460px, 100%);
    margin: 0 auto;
  }
  .auth-mobile-brand {
    display: inline-flex;
    margin-bottom: 34px;
  }
  .auth-heading h2 {
    font-size: 30px;
  }
  .auth-heading p {
    max-width: 34ch;
  }
}
@media (max-width: 430px) {
  .home-primary-actions {
    grid-template-columns: 1fr;
  }
  .home-stat-grid .stat-card {
    flex-basis: 148px;
  }
  .chat-header small {
    max-width: 38vw;
  }
  .composer-footer .attach-btn {
    max-width: 42%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .setting-row:not(.setting-row-stack) {
    align-items: flex-start;
  }
  .settings-switch {
    margin-top: 3px;
  }
  .file-upload-row {
    grid-template-columns: 1fr;
  }
  .file-upload-row .btn {
    width: 100%;
  }
}
.nav-symbol {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--bg3);
  color: var(--text2);
  font-size: 13px;
  font-weight: 800;
}

.side-section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 6px;
  padding: 8px 8px 6px 10px;
  color: var(--text2);
}

.side-section-heading .grow {
  flex: 1;
  min-width: 0;
}

.side-section-heading b {
  display: block;
  color: var(--text1);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.side-section-heading small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.side-section-heading .btn {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 12px;
}

@media (max-width: 760px) {
  .nav-symbol {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }
  .side-section-heading {
    padding-inline: 9px;
  }
}
.auth-mode-switch:has(.auth-mode-btn[hidden]) {
  grid-template-columns: 1fr;
}

/* Touch devices reveal message actions on demand rather than showing a
   toolbar under every message. elm-bridge toggles data-touch-actions. */
@media (hover: none) and (pointer: coarse) {
  .msg-actions {
    position: static;
    display: none !important;
    width: fit-content;
    margin-top: 6px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .msg[data-touch-actions=open] .msg-actions {
    display: flex !important;
  }
  .msg[data-touch-actions=open] {
    background: var(--hover-soft);
  }
  .msg-action {
    min-height: 38px;
    padding: 6px 11px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--bg3), transparent 6%);
  }
}
/* Dependency-free line icons keep navigation consistent across platforms. */
.ui-icon {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: currentColor;
  font-size: 0;
}

.ui-icon::before,
.ui-icon::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
}

.ui-icon-home::before {
  left: 5px;
  bottom: 3px;
  width: 10px;
  height: 9px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 1px 1px 3px 3px;
}

.ui-icon-home::after {
  left: 5px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
  border-radius: 2px 0 0;
}

.ui-icon-forums::before {
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.ui-icon-forums::after {
  left: 6px;
  top: 6px;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor;
}

.ui-icon-messages::before {
  inset: 3px 2px 5px;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.ui-icon-messages::after {
  left: 5px;
  bottom: 2px;
  width: 6px;
  height: 6px;
  border-left: 2px solid currentColor;
  transform: skewY(-38deg);
}

.ui-icon-friends::before {
  left: 6px;
  top: 2px;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.ui-icon-friends::after {
  left: 3px;
  bottom: 2px;
  width: 14px;
  height: 8px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 9px 9px 2px 2px;
}

.ui-icon-servers::before {
  left: 3px;
  top: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}

.ui-icon-servers::after {
  left: 9px;
  top: 4px;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}

.ui-icon-settings::before {
  left: 2px;
  top: 4px;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}

.ui-icon-settings::after {
  left: 5px;
  top: 2px;
  width: 4px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: var(--bg3);
  box-shadow: 6px 5px 0 -1px var(--bg3), 6px 5px 0 1px currentColor, -2px 10px 0 -1px var(--bg3), -2px 10px 0 1px currentColor;
}

.ui-icon-profile::before {
  left: 6px;
  top: 2px;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.ui-icon-profile::after {
  left: 4px;
  bottom: 2px;
  width: 12px;
  height: 7px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

@media (max-width: 760px) {
  [data-mobile-keyboard=open] .layout {
    padding-bottom: 0;
  }
  [data-mobile-keyboard=open] .mobile-nav {
    display: none;
  }
  [data-mobile-keyboard=open] .call-layer,
  [data-mobile-keyboard=open] .pw-float {
    bottom: 8px !important;
  }
}
@media (max-width: 760px) {
  [data-mobile-keyboard=open] .layout {
    height: var(--pw-visual-height, 100dvh);
  }
}
.auth-mode-switch.single {
  grid-template-columns: 1fr;
}

.settings-about-row {
  color: var(--text2);
}

.segmented-control .btn.active-choice {
  border-color: color-mix(in srgb, var(--accent), var(--line) 44%);
  background: color-mix(in srgb, var(--accent), transparent 88%);
  color: var(--text1);
}

.choice-card:hover {
  transform: none;
}

.choice-card-icon,
.choice-card.selected .choice-card-icon {
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--text2);
  box-shadow: none;
}

.choice-card.selected .choice-card-icon {
  border-color: color-mix(in srgb, var(--accent), var(--line) 50%);
  color: var(--accent);
}

.chat-mobile-menu {
  display: none;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg2);
  color: var(--text1);
  cursor: pointer;
  place-items: center;
}

.channel-header-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 9px;
  background: var(--bg2);
  color: var(--muted);
  font-size: 22px;
  font-weight: 500;
}

@media (max-width: 760px) {
  .main:has(.chat-content) > .topbar {
    display: none;
  }
  .chat-mobile-menu {
    display: grid;
  }
  .chat-header,
  .chat-status {
    padding-top: max(9px, env(safe-area-inset-top));
  }
  .chat-header {
    min-height: calc(62px + env(safe-area-inset-top));
  }
  .chat-status {
    min-height: calc(48px + env(safe-area-inset-top));
  }
}
.ui-icon-notifications::before {
  left: 5px;
  top: 3px;
  width: 10px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 7px 7px 4px 4px;
  border-bottom-width: 1px;
}

.ui-icon-notifications::after {
  left: 8px;
  bottom: 2px;
  width: 4px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

/* Small product primitives used by the release shell. */
.topbar-title {
  min-width: 0;
  flex: 1;
}

.topbar-title h2,
.topbar-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title small {
  margin-top: 1px;
  font-size: 11px;
}

.topbar-connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.topbar-connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aa7b25;
}

.topbar-connection.online .topbar-connection-dot {
  background: var(--ok);
}

.topbar-connection.reconnecting {
  color: color-mix(in srgb, #d39a35, var(--text) 30%);
}

.ui-icon-menu::before {
  left: 3px;
  top: 5px;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor;
}

.ui-icon-search::before {
  left: 3px;
  top: 3px;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.ui-icon-search::after {
  right: 2px;
  bottom: 3px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: right center;
}

.call-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: currentColor;
}

.call-icon-mic::before {
  left: 6px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.call-icon-mic::after {
  left: 4px;
  top: 8px;
  width: 10px;
  height: 7px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 7px 7px;
  box-shadow: 0 3px 0 -1px currentColor;
}

.call-icon-audio::before {
  left: 2px;
  top: 6px;
  width: 5px;
  height: 6px;
  border-radius: 2px 0 0 2px;
  background: currentColor;
  box-shadow: 4px 0 0 -1px currentColor;
}

.call-icon-audio::after {
  right: 1px;
  top: 4px;
  width: 7px;
  height: 10px;
  border: 2px solid currentColor;
  border-left: 0;
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 0 10px 10px 0;
}

.call-icon-screen::before {
  left: 2px;
  top: 3px;
  width: 14px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.call-icon-screen::after {
  left: 6px;
  bottom: 1px;
  width: 6px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.call-icon-close::before,
.call-icon-close::after {
  left: 8px;
  top: 2px;
  width: 2px;
  height: 14px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
}

.call-icon-close::after {
  transform: rotate(-45deg);
}

.call-icon-off {
  background: linear-gradient(45deg, transparent 44%, currentColor 46%, currentColor 53%, transparent 55%);
}

.call-bar-icon,
.call-overlay-icon,
.dm-call-bar-icon {
  box-shadow: none;
  animation: none;
}

.call-bar-icon .live-dot,
.call-overlay-icon .live-dot,
.dm-call-bar-icon .live-dot {
  width: 9px;
  height: 9px;
  background: #fff;
  box-shadow: none;
}

.forum-search-icon .ui-icon {
  width: 18px;
  height: 18px;
}

@media (max-width: 760px) {
  .topbar-connection {
    padding: 0;
    width: 28px;
    min-width: 28px;
    justify-content: center;
    border: 0;
    background: transparent;
  }
  .topbar-connection > span:last-child {
    display: none;
  }
  .topbar-title small {
    display: none;
  }
}
.auth-form-wrap {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg2);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.12);
}

.auth-instance-meta {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 920px) {
  .auth-form-wrap {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
}
/* Final phone stability pass. Keep fixed chrome on compositor layers and avoid
   layout-moving left/top animations that tend to stutter on mobile browsers. */
@media (max-width: 760px) {
  html,
  body {
    overscroll-behavior: none;
    -webkit-text-size-adjust: 100%;
  }
  button,
  a,
  input,
  textarea,
  select {
    -webkit-tap-highlight-color: transparent;
  }
  .side {
    left: 0;
    transform: translate3d(calc(-100% - 24px), 0, 0);
    transition: transform 0.2s cubic-bezier(0.2, 0.75, 0.25, 1);
    will-change: transform;
  }
  .side.open {
    left: 0;
    transform: translate3d(0, 0, 0);
  }
  .drawer-overlay {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }
  .drawer-overlay.open {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
  .mobile-nav,
  .topbar {
    transform: translateZ(0);
    backface-visibility: hidden;
  }
  .mobile-nav {
    contain: layout paint;
  }
  .mobile-nav-btn {
    position: relative;
  }
  .mobile-nav-btn.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 3px;
    width: 18px;
    height: 2px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: var(--accent);
  }
  .chat-content {
    overscroll-behavior: none;
  }
  .messages {
    scrollbar-width: none;
  }
  .messages::-webkit-scrollbar {
    display: none;
  }
  .message-image {
    max-height: 48dvh;
    border-radius: 9px;
  }
  .link-embed,
  .embed,
  .message-image-link,
  .media-attachment {
    max-width: 100%;
  }
  .forum-directory-hero,
  .forum-view-header,
  .thread-post,
  .forum-thread {
    box-shadow: none;
  }
  .forum-directory-hero {
    border-radius: 13px;
  }
  .forum-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .forum-thread {
    padding: 12px 10px;
    gap: 8px;
  }
  .vote-column {
    width: 34px;
    flex-basis: 34px;
  }
  .vote-btn {
    width: 32px;
    min-height: 30px;
  }
  .profile-body .nav-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .profile-body .nav-actions .btn {
    width: 100%;
  }
  .home-activity-copy b {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .home-quick-links {
    grid-template-columns: 1fr 1fr;
  }
  .account-dialog-body,
  .modal-body,
  .settings-content,
  .settings-card,
  .setting-row,
  .field {
    min-width: 0;
  }
  .modal-card,
  .account-dialog,
  .servers-sheet-card {
    overscroll-behavior: contain;
  }
  [data-reduce-motion=true] .side,
  [data-reduce-motion=true] .drawer-overlay {
    transition: none;
  }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .side,
  .drawer-overlay {
    transition: none;
  }
}
@media (max-width: 760px) and (orientation: landscape) and (max-height: 520px) {
  :root {
    --mobile-nav-h: 54px;
    --header-h: 50px;
  }
  .mobile-nav button {
    height: 46px;
    min-height: 46px;
  }
  .mobile-nav-label {
    display: none;
  }
  .mobile-nav-icon {
    margin: 0;
  }
  .auth-form-panel {
    padding-top: max(16px, env(safe-area-inset-top));
  }
  .auth-mobile-brand {
    margin-bottom: 18px;
  }
  .auth-heading {
    margin-bottom: 14px;
  }
  .pw-float {
    height: min(62dvh, 300px) !important;
    max-height: 62dvh !important;
  }
}
/* Native file controls are intentionally hidden. They look different on every
   browser and were one of the last inconsistent parts of settings. */
.file-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-top: 9px;
}

.file-picker-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.file-picker-button {
  flex: 0 0 auto;
  cursor: pointer;
}

.file-picker-button.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.file-picker-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Keep auth understated. Product UIs age better when the panel is flat rather
   than relying on decorative gradients and glow effects. */
.auth-brand-panel {
  background: var(--bg3);
}

.auth-brand-panel::after {
  display: none;
}

@media (max-width: 520px) {
  .file-picker-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .file-picker-button {
    width: 100%;
  }
  .file-picker-row small {
    white-space: normal;
  }
}
.servers-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 14px;
}

.servers-sheet-head h3 {
  margin: 0;
  color: var(--text1);
  font-size: 18px;
}

.servers-sheet-head small {
  display: block;
  margin-top: 2px;
}

.sheet-close {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.sheet-close:hover {
  background: var(--hover);
  color: var(--text1);
}

.servers-sheet-list {
  display: grid;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
}

.servers-sheet-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}

@media (max-width: 430px) {
  .servers-sheet-actions {
    grid-template-columns: 1fr;
  }
}
.settings-tab {
  width: calc(100% - 24px);
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.channel-link {
  text-decoration: none;
}

.channel-link:hover {
  text-decoration: none;
}

@media (max-width: 760px) {
  .settings-tab {
    width: auto;
  }
}
.choice-card-check {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.choice-card.selected .choice-card-check {
  border-color: var(--accent);
  background: var(--accent);
}

.choice-card.selected .choice-card-check::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 5px;
  height: 8px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(42deg);
}

.theme-choice {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.theme-preview {
  position: relative;
  display: block;
  width: 54px;
  height: 40px;
  flex: 0 0 54px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f7f9;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.theme-preview-rail,
.theme-preview-panel {
  position: absolute;
  display: block;
}

.theme-preview-rail {
  inset: 0 auto 0 0;
  width: 13px;
  background: #e4e7eb;
  border-right: 1px solid #cfd5dc;
}

.theme-preview-panel {
  left: 19px;
  top: 9px;
  width: 27px;
  height: 21px;
  border: 1px solid #d9dde3;
  border-radius: 4px;
  background: #fff;
}

.theme-preview-dark {
  border-color: #343941;
  background: #17191d;
}

.theme-preview-dark .theme-preview-rail {
  border-color: #2c3138;
  background: #0d0f12;
}

.theme-preview-dark .theme-preview-panel {
  border-color: #343941;
  background: #1d2025;
}

.theme-preview-system {
  background: linear-gradient(90deg, #f6f7f9 0 50%, #17191d 50% 100%);
}

.theme-preview-system .theme-preview-rail {
  background: linear-gradient(90deg, #e4e7eb 0 50%, #0d0f12 50% 100%);
}

.theme-preview-system .theme-preview-panel {
  border-color: #777f89;
  background: linear-gradient(90deg, #fff 0 50%, #1d2025 50% 100%);
}

/* Voice rooms get their own layout rather than looking like a settings card. */
.voice-card {
  width: min(920px, 100%);
  margin-inline: auto;
  padding: 24px;
}

.voice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.voice-header h2 {
  margin: 0;
  color: var(--text1);
  font-size: 24px;
  letter-spacing: -0.025em;
}

.voice-count {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text2);
  background: var(--bg3);
  font-size: 11px;
  font-weight: 700;
}

.voice-actions {
  display: flex;
  gap: 8px;
  margin: 20px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg3);
}

.voice-actions .btn {
  min-height: 42px;
}

.voice-actions .primary-join {
  min-width: 118px;
}

.voice-participants {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 9px;
  margin-top: 14px;
}

.voice-participant {
  min-height: 62px;
  border-radius: 11px;
  background: var(--bg3);
}

.voice-screen-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent), var(--line) 62%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent), transparent 92%);
  color: var(--text2);
  font-size: 12px;
}

@media (max-width: 760px) {
  .voice-card {
    width: 100%;
    padding: 16px 12px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }
  .voice-header h2 {
    font-size: 21px;
  }
  .voice-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 16px 0 14px;
    padding: 10px;
  }
  .voice-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 46px;
  }
  .voice-actions .primary-join,
  .voice-actions .call-decline:first-child {
    grid-column: 1/-1;
  }
  .voice-participants {
    grid-template-columns: 1fr;
  }
}
.add-friend-icon,
.friend-discovery-hint .discovery-art {
  color: var(--accent);
  background: var(--bg3);
  box-shadow: none;
}

.add-friend-icon .ui-icon,
.friend-discovery-hint .discovery-art .ui-icon {
  width: 22px;
  height: 22px;
}

.add-friend-search-icon {
  display: grid;
  place-items: center;
  transform: none;
}

@media (max-width: 760px) {
  .friends-toolbar {
    position: sticky;
    top: 0;
    z-index: 11;
    margin: -14px -12px 0;
    padding: 12px 12px 8px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg), transparent 4%);
  }
  .friends-tabs {
    margin-inline: -4px;
    padding: 0 4px 4px;
    scroll-snap-type: x proximity;
  }
  .friends-tab {
    min-height: 40px;
    scroll-snap-align: start;
  }
  .friend-row {
    align-items: flex-start;
  }
  .friend-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin: 6px 0 0;
    padding-left: 51px;
    gap: 7px;
  }
  .friend-actions .btn {
    width: 100%;
    min-width: 0;
  }
  .request-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    padding-left: 51px;
    gap: 7px;
  }
  .message-request-row {
    flex-wrap: wrap;
  }
  .request-actions .btn {
    width: 100%;
  }
}
@media (max-width: 390px) {
  .friend-actions,
  .request-actions {
    grid-template-columns: 1fr;
  }
}
.rail-divider {
  width: 30px;
  height: 1px;
  margin: 2px 0 3px;
  background: var(--line);
}

/* 1.4.0 final product refinement
   Keep the visual system quiet: hierarchy comes from spacing, type, and
   surface contrast instead of glow, excessive gradients, or decorative noise. */
.page-stack {
  display: grid;
  gap: 18px;
  width: min(var(--content-max), 100%);
  margin-inline: auto;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  min-width: 0;
  padding: 4px 2px 14px;
  border-bottom: 1px solid var(--line);
}

.page-heading > div {
  min-width: 0;
}

.page-heading h1 {
  margin: 3px 0 5px;
  color: var(--text1);
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.page-heading p {
  margin: 0;
  line-height: 1.5;
}

.compact-section-head {
  margin-bottom: 10px;
}

.compact-section-head h2 {
  font-size: 17px;
}

.compact-section-head p {
  font-size: 12px;
}

.dm-message-section,
.dm-request-section {
  min-width: 0;
}

.dm-list-card {
  padding: 5px;
}

.dm-list-card .dm-row {
  border-radius: 10px;
}

/* Server overview */
.server-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 24px;
  min-height: 220px;
  padding: clamp(22px, 4vw, 34px);
  overflow: hidden;
  background: var(--bg2);
  background-position: center;
  background-size: cover;
}

.server-hero.has-banner::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: rgba(10, 11, 14, 0.68);
}

.server-hero.has-banner {
  color: #f3f4f7;
}

.server-hero.has-banner .muted,
.server-hero.has-banner p {
  color: rgba(243, 244, 247, 0.78);
}

.server-hero-main {
  display: flex;
  align-items: center;
  gap: 17px;
  min-width: 0;
}

.server-hero-main .server-icon {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  border: 1px solid color-mix(in srgb, var(--line), transparent 20%);
  border-radius: 20px;
  font-size: 27px;
  background: color-mix(in srgb, var(--bg3), transparent 5%);
}

.server-hero-copy {
  min-width: 0;
}

.server-hero-copy h1 {
  margin: 3px 0 6px;
  overflow-wrap: anywhere;
  color: inherit;
  font-size: clamp(27px, 4vw, 42px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.server-hero-copy p {
  max-width: 60ch;
  margin: 0;
  color: var(--text2);
  line-height: 1.55;
}

.server-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
  align-self: start;
}

.server-meta-item,
.server-role-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--line), transparent 12%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg3), transparent 8%);
  color: var(--text2);
  font-size: 11px;
}

.server-meta-item b {
  color: var(--text1);
  font-size: 12px;
}

.server-role-badge {
  text-transform: capitalize;
  font-weight: 700;
}

.server-hero.has-banner .server-meta-item,
.server-hero.has-banner .server-role-badge {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(14, 15, 18, 0.5);
  color: rgba(255, 255, 255, 0.78);
}

.server-hero.has-banner .server-meta-item b {
  color: #fff;
}

.server-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 1/-1;
  padding-top: 4px;
}

.server-hero-actions .btn {
  min-height: 40px;
}

.server-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 14px;
  align-items: start;
}

.server-overview-panel {
  min-width: 0;
  padding: 16px;
}

.server-channel-card,
.server-member-list {
  display: grid;
  gap: 2px;
}

.server-overview-panel .channel-group-title {
  margin: 10px 8px 4px;
}

.server-overview-panel .row {
  min-height: 52px;
}

.server-member-list {
  max-height: 520px;
  overflow: auto;
  overscroll-behavior: contain;
}

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 240px;
  color: var(--muted);
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: plainwire-loading-pulse 1s ease-in-out infinite alternate;
}

@keyframes plainwire-loading-pulse {
  to {
    opacity: 0.3;
    transform: scale(0.82);
  }
}
/* Profile */
.profile-page-card {
  width: min(880px, 100%);
  margin-inline: auto;
  overflow: hidden;
}

.profile-cover {
  position: relative;
  height: 190px !important;
  border-radius: 0 !important;
  background-color: var(--bg3) !important;
}

.profile-cover.empty::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(90deg, color-mix(in srgb, var(--line), transparent 76%) 1px, transparent 1px), linear-gradient(color-mix(in srgb, var(--line), transparent 76%) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.3;
}

.profile-layout {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 22px;
  padding: 0 28px 28px;
}

.profile-avatar-column {
  position: relative;
  z-index: 2;
  margin-top: -52px;
}

.profile-avatar-column .avatar.big {
  width: 104px;
  height: 104px;
  margin: 0;
  border: 5px solid var(--bg2);
  font-size: 34px;
}

.profile-copy {
  min-width: 0;
  padding-top: 20px;
}

.profile-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.profile-title-row h1 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text1);
  font-size: 26px;
  letter-spacing: -0.025em;
}

.profile-identity {
  margin: 2px 0 0;
}

.profile-presence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg3);
  color: var(--text2);
  font-size: 11px;
  white-space: nowrap;
}

.profile-presence .status-dot {
  width: 8px;
  height: 8px;
}

.profile-bio {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.profile-section-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.profile-bio p {
  max-width: 64ch;
  margin: 0;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.profile-more-action {
  margin-left: auto;
}

/* Notification inbox and search results */
.notifications-list {
  overflow: hidden;
}

.notification-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 12px;
  min-height: 74px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  transition: background 0.1s ease;
}

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

.notification-row:hover {
  background: var(--hover-soft);
  text-decoration: none;
}

.notification-row.unseen {
  background: color-mix(in srgb, var(--accent), transparent 94%);
}

.notification-mark {
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--line2);
}

.notification-row.unseen .notification-mark {
  background: var(--accent);
}

.notification-copy {
  min-width: 0;
}

.notification-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.notification-title-row b {
  color: var(--text1);
  font-size: 13px;
  text-transform: capitalize;
}

.notification-copy p {
  margin: 4px 0 0;
  color: var(--text2);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.notif-time {
  flex: 0 0 auto;
  font-size: 11px;
}

.notifications-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 260px;
  font-style: normal;
}

.notifications-empty .ui-icon {
  width: 28px;
  height: 28px;
  color: var(--muted);
}

.notifications-empty h2 {
  margin: 4px 0 0;
  color: var(--text1);
}

.notifications-empty p {
  margin: 0;
}

.search-result-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 14px;
  align-items: start;
}

.search-result-section {
  min-width: 0;
  overflow: hidden;
}

.search-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.search-result-head h2 {
  margin: 0;
  color: var(--text1);
  font-size: 16px;
}

.search-result-section > div:last-child {
  padding: 5px;
}

/* Drawer header and mobile escape affordance */
.side-title-row,
.server-side-identity {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.side-title-copy {
  flex: 1;
  min-width: 0;
}

.side-close {
  display: none;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg3);
  color: var(--text1);
  cursor: pointer;
  place-items: center;
}

/* Better focus visibility without bright decorative effects. */
.btn:focus-visible,
.rail-btn:focus-visible,
.settings-tab:focus-visible,
.row:focus-visible,
.mobile-nav button:focus-visible,
.side-close:focus-visible,
.chat-mobile-menu:focus-visible,
.notification-row:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent), #fff 18%);
  outline-offset: 2px;
}

/* Tablet: preserve the product shell but reduce secondary chrome. */
@media (max-width: 1040px) {
  :root {
    --side-w: 244px;
  }
  .layout {
    gap: 7px;
    padding: 7px;
  }
  .server-overview-grid {
    grid-template-columns: 1fr;
  }
  .server-member-list {
    max-height: 360px;
  }
  .search-result-grid {
    grid-template-columns: 1fr;
  }
}
/* Phone UI is intentionally different from desktop rather than a squeezed
   desktop layout. */
@media (max-width: 760px) {
  html,
  body,
  #app {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  .layout {
    min-width: 0;
    height: var(--pw-visual-height, 100dvh);
  }
  .main {
    min-width: 0;
    height: 100%;
  }
  .content {
    min-width: 0;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }
  .side {
    width: min(88vw, 330px);
    left: calc(-1 * min(88vw, 330px) - 16px);
    padding-top: env(safe-area-inset-top);
    box-shadow: 18px 0 42px rgba(0, 0, 0, 0.32);
  }
  .side.open {
    left: 0;
  }
  .side-head {
    padding: 13px 13px 12px;
  }
  .side-title-row,
  .server-side-identity {
    align-items: center;
  }
  .side-close {
    display: grid;
  }
  .side-head h1 {
    font-size: 16px;
  }
  .side-head small {
    max-width: 27ch;
  }
  .drawer-overlay.open {
    display: block;
    background: rgba(5, 6, 8, 0.54);
    backdrop-filter: blur(2px);
  }
  .page-stack {
    gap: 14px;
  }
  .page-heading {
    align-items: flex-start;
    padding: 2px 1px 12px;
    gap: 12px;
  }
  .page-heading h1 {
    font-size: 25px;
  }
  .page-heading p {
    font-size: 13px;
  }
  .page-heading > .btn {
    flex: 0 0 auto;
    min-height: 42px;
    padding-inline: 12px;
  }
  .dm-list-card {
    margin-inline: -4px;
    border-left: 0;
    border-right: 0;
    border-radius: 12px;
  }
  .dm-list-card .dm-row {
    min-height: 64px;
  }
  .server-hero {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 14px;
    padding: 18px 15px;
    border-radius: 14px;
  }
  .server-hero-main {
    align-items: flex-start;
  }
  .server-hero-main .server-icon {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
    border-radius: 16px;
    font-size: 22px;
  }
  .server-hero-copy h1 {
    font-size: 27px;
  }
  .server-meta {
    justify-content: flex-start;
    align-self: stretch;
  }
  .server-hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .server-hero-actions .btn:first-child {
    grid-column: 1/-1;
  }
  .server-overview-grid {
    gap: 10px;
  }
  .server-overview-panel {
    padding: 12px 9px;
  }
  .server-member-list {
    max-height: none;
  }
  .server-overview-panel .row {
    min-height: 58px;
  }
  .profile-page-card {
    width: calc(100% + 24px);
    margin-inline: -12px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .profile-cover {
    height: 136px !important;
  }
  .profile-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 16px 22px;
  }
  .profile-avatar-column {
    margin-top: -45px;
  }
  .profile-avatar-column .avatar.big {
    width: 90px;
    height: 90px;
    border-width: 4px;
  }
  .profile-copy {
    padding-top: 12px;
  }
  .profile-title-row {
    display: block;
  }
  .profile-title-row h1 {
    font-size: 23px;
  }
  .profile-presence {
    margin-top: 10px;
  }
  .profile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profile-actions .btn {
    width: 100%;
  }
  .profile-more-action {
    margin-left: 0;
  }
  .notifications-page .page-heading {
    align-items: center;
  }
  .notifications-list {
    margin-inline: -12px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
  .notification-row {
    min-height: 72px;
    padding: 13px 12px;
  }
  .notification-title-row {
    gap: 8px;
  }
  .notification-copy p {
    font-size: 13px;
  }
  .search-result-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .search-result-section {
    border-radius: 12px;
  }
  /* Bottom nav: generous tap targets and no overlap with page content. */
  .mobile-nav {
    height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
    padding: 5px 5px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg3), transparent 2%);
    border-top-color: color-mix(in srgb, var(--line), transparent 8%);
    box-shadow: 0 -8px 22px rgba(0, 0, 0, 0.14);
  }
  .mobile-nav button {
    min-width: 0;
    min-height: 52px;
    flex: 1 1 0;
    border-radius: 11px;
  }
  .mobile-nav button.active {
    background: color-mix(in srgb, var(--accent), transparent 90%);
    color: var(--text1);
  }
  .mobile-nav button.active .ui-icon {
    color: var(--accent);
  }
  /* Keep primary chat chrome fixed in the visual viewport while the keyboard
     opens. This avoids the composer jumping behind browser UI. */
  .chat-content {
    height: 100%;
  }
  .chat-surface {
    max-height: 100%;
  }
  .messages {
    padding-bottom: 10px;
  }
  .composer {
    flex: 0 0 auto;
    padding-bottom: max(9px, env(safe-area-inset-bottom));
  }
  [data-mobile-keyboard=open] .composer {
    padding-bottom: 8px;
  }
  [data-mobile-keyboard=open] .mobile-nav {
    visibility: hidden;
    pointer-events: none;
  }
  /* Native controls and destructive actions stay usable with one thumb. */
  .setting-row:not(.setting-row-stack) {
    min-height: 62px;
  }
  .settings-switch {
    flex: 0 0 48px;
  }
  .danger-zone {
    align-items: flex-start;
    gap: 12px;
  }
  .danger-zone .btn {
    min-width: 92px;
  }
  .page-loading {
    min-height: 45dvh;
  }
}
@media (max-width: 430px) {
  .page-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .page-heading > div {
    grid-column: 1/-1;
  }
  .page-heading > .btn {
    grid-column: 2;
  }
  .server-hero-actions,
  .profile-actions {
    grid-template-columns: 1fr;
  }
  .server-hero-actions .btn:first-child {
    grid-column: auto;
  }
  .notification-title-row {
    display: block;
  }
  .notif-time {
    display: block;
    margin-top: 2px;
  }
}
/* 1.4.0 final shell and phone interaction pass
   Remove duplicate chrome and make touch layouts purpose-built instead of
   scaled desktop views. */
.route-chat > .topbar,
.route-settings > .topbar {
  display: none;
}

.route-chat > .chat-content {
  height: 100%;
  min-height: 0;
}

.chat-connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, #c88b32, var(--line) 62%);
  border-radius: 999px;
  background: color-mix(in srgb, #c88b32, transparent 91%);
  color: color-mix(in srgb, #d9a456, var(--text1) 28%);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.chat-connection-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: currentColor;
  animation: reconnect-pulse 1.3s ease-in-out infinite alternate;
}

@keyframes reconnect-pulse {
  to {
    opacity: 0.38;
  }
}
.chat-call-action {
  gap: 7px;
}

.composer-action {
  gap: 7px;
}

.composer-send .ui-icon {
  color: currentColor;
}

/* Small line icons for high-frequency controls. They use currentColor and no
   external icon font so they stay crisp in self-hosted and offline installs. */
.ui-icon-attach::before {
  left: 6px;
  top: 2px;
  width: 9px;
  height: 16px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 7px;
  transform: rotate(38deg);
}

.ui-icon-attach::after {
  left: 7px;
  top: 6px;
  width: 6px;
  height: 10px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 5px;
  transform: rotate(38deg);
}

.ui-icon-send::before {
  left: 3px;
  top: 4px;
  width: 14px;
  height: 12px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: skewX(-28deg) rotate(18deg);
}

.ui-icon-send::after {
  left: 6px;
  top: 9px;
  width: 10px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-21deg);
  transform-origin: left center;
}

.ui-icon-call::before,
.ui-icon-call-end::before {
  left: 5px;
  top: 3px;
  width: 10px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 8px 4px 8px 4px;
  transform: rotate(-42deg);
}

.ui-icon-call-end::after {
  left: 3px;
  top: 9px;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-18deg);
}

/* Mobile settings use a native-feeling horizontal section rail. A select menu
   made settings hard to scan and hid where you were. */
@media (max-width: 760px) {
  .route-settings > .content {
    padding-top: 0;
  }
  .settings-mobile-nav {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 30;
    gap: 6px;
    margin: 0 -12px;
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 9px max(12px, env(safe-area-inset-left));
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg), transparent 2%);
  }
  .settings-mobile-nav::-webkit-scrollbar {
    display: none;
  }
  .settings-mobile-tab {
    min-height: 38px;
    flex: 0 0 auto;
    padding: 0 13px;
    scroll-snap-align: center;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text2);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
  }
  .settings-mobile-tab:hover {
    background: var(--hover-soft);
    color: var(--text1);
  }
  .settings-mobile-tab.active {
    border-color: color-mix(in srgb, var(--accent), var(--line) 60%);
    background: color-mix(in srgb, var(--accent), transparent 90%);
    color: var(--text1);
  }
  .settings-content-top {
    min-height: 84px;
    padding-top: 16px;
  }
  /* Chat has its own conversation header. Hiding the global title bar removes
     the double-header bug and gives a phone another row of useful space. */
  .route-chat {
    height: 100%;
  }
  .route-chat .chat-content {
    height: 100%;
  }
  .route-chat .chat-header {
    min-height: calc(60px + env(safe-area-inset-top));
    padding-top: calc(8px + env(safe-area-inset-top));
  }
  .route-chat .chat-status {
    min-height: calc(42px + env(safe-area-inset-top));
    padding-top: calc(7px + env(safe-area-inset-top));
  }
  .chat-connection-badge {
    max-width: 32vw;
    min-height: 28px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .chat-call-action {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px;
    min-height: 42px !important;
    padding: 0 !important;
    border-radius: 11px !important;
  }
  .chat-call-action .ui-icon {
    width: 19px;
    height: 19px;
  }
  .chat-call-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .composer {
    padding-inline: 9px;
  }
  .composer-footer {
    min-height: 44px;
  }
  .composer-hint {
    display: none !important;
  }
  .composer-action {
    width: 44px;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    border-radius: 12px !important;
  }
  .composer-send {
    margin-left: auto;
  }
  .composer-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .composer-action .ui-icon {
    width: 20px;
    height: 20px;
  }
  .reply-bar {
    min-height: 42px;
    padding-inline: 10px;
  }
  .reply-preview-text {
    min-width: 0;
  }
  /* Avoid tiny side gutters that make sheets and content look accidentally
     uncentered on narrow phones. */
  .modal,
  .account-dialog-backdrop {
    padding-inline: 0;
  }
  .modal-card,
  .action-modal,
  .account-dialog {
    border-left: 0;
    border-right: 0;
  }
  .servers-sheet .servers-sheet-card {
    border-left: 0;
    border-right: 0;
  }
}
@media (max-width: 390px) {
  .chat-header {
    gap: 7px;
  }
  .chat-header .avatar,
  .chat-header .presence-avatar .avatar {
    width: 36px;
    height: 36px;
  }
  .chat-connection-badge {
    display: none;
  }
  .settings-mobile-tab {
    padding-inline: 11px;
  }
}
@media (max-width: 760px) and (orientation: landscape) and (max-height: 500px) {
  :root {
    --mobile-nav-h: 52px;
  }
  .mobile-nav {
    padding-top: 2px;
  }
  .mobile-nav button {
    min-height: 46px;
    height: 46px;
  }
  .mobile-nav-label {
    display: none;
  }
  .route-chat .chat-header {
    min-height: calc(52px + env(safe-area-inset-top));
    padding-block: calc(5px + env(safe-area-inset-top)) 5px;
  }
}
/* Mobile interaction polish: menus and transient UI behave as touch surfaces
   instead of desktop popovers stranded at pointer coordinates. */
@media (max-width: 760px) {
  .ctx-backdrop {
    z-index: 498;
    background: rgba(0, 0, 0, 0.42);
  }
  .ctx-menu {
    left: max(8px, env(safe-area-inset-left)) !important;
    right: max(8px, env(safe-area-inset-right));
    top: auto !important;
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom) + 8px);
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 8px;
    border-radius: 16px;
    background: var(--bg2);
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.28);
    transform-origin: center bottom;
  }
  .ctx-item {
    min-height: 48px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 15px;
  }
  .ctx-item:hover {
    background: var(--hover);
    color: var(--text1);
  }
  .ctx-item.ctx-danger {
    color: color-mix(in srgb, var(--danger), var(--text1) 22%);
  }
  .ctx-item.ctx-danger:hover {
    background: color-mix(in srgb, var(--danger), transparent 88%);
    color: color-mix(in srgb, var(--danger), #fff 24%);
  }
  .ctx-sep {
    margin-block: 5px;
  }
  [data-mobile-keyboard=open] .ctx-menu {
    bottom: 8px;
  }
  .message-file,
  .media-attachment,
  .link-embed {
    width: min(100%, 560px);
  }
  .forum-search-input,
  #globalSearch,
  .search-field input {
    min-height: 46px;
  }
  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom) + 12px);
    width: auto;
    max-width: none;
  }
  [data-mobile-keyboard=open] .toast {
    bottom: 12px;
  }
}
.mobile-nav-icon-wrap {
  position: relative;
  display: grid;
  place-items: center;
  line-height: 1;
}

.mobile-nav-badge {
  position: absolute;
  top: -7px;
  left: 13px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg2);
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
  .mobile-nav-icon-wrap {
    width: 24px;
    height: 22px;
  }
}
/* Keep settings content deliberately centered within the available pane. */
.settings-content-inner {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.server-sheet-row {
  width: 100%;
  border: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
}

.server-sheet-row:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent), #fff 18%);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .settings-content-inner {
    display: block;
  }
}
.account-action-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.diagnostics-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}

.diagnostics-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 44px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text2);
  font-size: 13px;
}

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

.diagnostics-row b {
  color: var(--text1);
  font-size: 13px;
  text-align: right;
}

.diagnostics-value.good {
  color: var(--ok);
}

.diagnostics-value.warn {
  color: #b8872e;
}

.diagnostics-value.bad {
  color: var(--danger);
}

@media (max-width: 760px) {
  .diagnostics-row {
    min-height: 48px;
  }
  .account-dialog-actions {
    gap: 7px;
  }
  .account-dialog-actions .btn {
    min-width: 0;
  }
}
/* Plainwire 1.4.0 release candidate visual system
   This block is intentionally restrained. It resolves the last high-frequency
   desktop and phone surfaces without adding decorative gradients or glow. */
:root,
[data-theme=light],
[data-theme=dark] {
  --control-h: 40px;
  --touch-h: 44px;
  --page-max: 1240px;
}

/* Keep the global shell quiet so content, not chrome, gets the attention. */
.topbar-title {
  min-width: 0;
}

.topbar-title h2,
.topbar-title small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title small {
  display: block;
  margin-top: 1px;
  font-size: 11px;
}

.topbar-connection.reconnecting {
  margin-left: auto;
  flex: 0 0 auto;
  color: #c4913e;
}

.side .list > .row:nth-child(1),
.side .list > .row:nth-child(2) {
  min-height: 48px;
}

/* Direct messages are the main content of the generic sidebar. */
.side .dm-row {
  min-height: 60px;
  margin-block: 1px;
}

.side .dm-row b {
  font-weight: 650;
}

.side .dm-preview {
  line-height: 1.3;
}

/* Auth is an instance entry screen, not a landing page. */
.auth-shell {
  min-height: 100dvh;
  background: var(--bg);
}

.auth-brand-panel {
  justify-content: center;
  gap: 54px;
  background: var(--bg3);
}

.auth-brand-lockup {
  position: absolute;
  top: clamp(28px, 5vw, 56px);
  left: clamp(28px, 5vw, 70px);
}

.auth-brand-copy {
  max-width: 620px;
}

.auth-brand-copy h1 {
  max-width: 10ch;
  margin: 10px 0 15px;
  font-size: clamp(42px, 5vw, 70px);
  line-height: 0.98;
  letter-spacing: -0.052em;
}

.auth-brand-copy > p {
  max-width: 50ch;
  color: var(--text2);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.62;
}

.auth-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  max-width: 620px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.auth-capabilities span {
  position: relative;
  padding: 13px 18px 13px 0;
  margin-right: 18px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.auth-capabilities span:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line2);
  transform: translateY(-50%);
}

.auth-form-panel {
  background: var(--bg2);
}

.auth-form-wrap {
  width: min(410px, 100%);
}

.auth-heading {
  margin-bottom: 20px;
}

.auth-heading h2 {
  font-size: 30px;
}

.auth-mode-switch {
  margin-bottom: 22px;
}

.auth-fields {
  gap: 13px;
}

.auth-fields .field label {
  color: var(--text2);
}

.auth-footnote {
  margin-top: 18px;
}

.auth-instance-meta {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

/* Center application pages consistently. */
.home-page,
.forum-page,
.server-page,
.thread-page,
.dm-inbox,
.friends-page,
.notifications-page,
.search-page,
.server-create-page {
  width: min(var(--page-max), 100%);
  margin-inline: auto;
}

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

.page-heading h1 {
  letter-spacing: -0.032em;
}

/* Cards should read as sections, not floating generated widgets. */
.card,
.stat-card,
.forum-card,
.forum-thread,
.settings-card,
.server-overview-panel,
.search-result-section,
.notifications-list,
.friends-list {
  border-color: var(--line);
  box-shadow: none;
}

.stat-card:hover,
.forum-card:hover,
.forum-thread:hover {
  transform: none;
  box-shadow: none;
}

/* Make chat feel like one continuous conversation surface. */
.chat-surface {
  border-color: var(--line);
  background: var(--bg);
}

.chat-header {
  min-height: 64px;
  padding-inline: 17px;
}

.chat-header .grow {
  min-width: 0;
}

.chat-header h2 {
  font-weight: 700;
}

.messages {
  padding-inline: 16px;
}

.msg-main {
  min-width: 0;
  flex: 1;
}

.msg {
  scroll-margin-block: 72px 110px;
}

.msg:hover {
  background: color-mix(in srgb, var(--hover), transparent 30%);
}

.msg.failed {
  background: color-mix(in srgb, var(--danger), transparent 94%);
}

.composer textarea {
  field-sizing: content;
  scrollbar-width: thin;
}

.composer-footer {
  min-height: 42px;
}

.composer-hint {
  margin-right: auto;
}

/* Settings use one stable reading column. */
.settings-content-inner {
  min-width: 0;
}

.settings-card {
  margin-inline: auto;
}

.setting-copy {
  min-width: 0;
}

.setting-copy > div {
  min-width: 0;
}

.setting-copy small {
  line-height: 1.45;
}

.settings-action-card {
  align-content: start;
  min-height: 96px;
}

.settings-action-card:hover {
  transform: none;
}

/* Native-feeling mobile experience. */
@media (max-width: 760px) {
  :root {
    --mobile-nav-h: 64px;
    --page-pad: 12px;
  }
  body {
    background: var(--bg);
  }
  .layout {
    padding-bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
  }
  .topbar {
    min-height: calc(58px + env(safe-area-inset-top));
    height: calc(58px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 11px 0;
  }
  .topbar-title {
    flex: 1;
  }
  .topbar-title h2 {
    font-size: 17px;
  }
  .topbar-title small {
    display: none;
  }
  .topbar-connection {
    padding-inline: 7px;
  }
  .topbar-connection span:last-child {
    display: none;
  }
  .sidebar-toggle {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 0;
    background: transparent;
  }
  .sidebar-toggle:hover {
    background: var(--hover);
  }
  .content {
    padding: 13px 12px 18px;
  }
  /* Drawer reads as navigation rather than a miniature desktop sidebar. */
  .side {
    --side-w: min(88vw, 350px);
    border-radius: 0 16px 16px 0;
  }
  .side-head {
    padding: calc(15px + env(safe-area-inset-top)) 13px 12px;
  }
  .side-head .nav-actions {
    gap: 7px;
  }
  .side-head .nav-actions .btn {
    min-height: 42px;
  }
  .side .list {
    padding: 6px 7px 12px;
  }
  .side .row {
    min-height: 54px;
  }
  .side .dm-row {
    min-height: 62px;
  }
  .user-panel {
    border-radius: 0 0 16px 0;
  }
  /* Five navigation targets, always thumb-sized, without pill/glow decoration. */
  .mobile-nav {
    min-height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
    padding: 4px max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
    gap: 0;
    box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.08);
  }
  .mobile-nav button {
    position: relative;
    height: 56px;
    min-height: 56px;
    border-radius: 8px;
    gap: 3px;
  }
  .mobile-nav button.active {
    background: transparent;
  }
  .mobile-nav button.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 1px;
    width: 22px;
    height: 2px;
    border-radius: 999px;
    background: var(--accent);
    transform: translateX(-50%);
  }
  .mobile-nav-label {
    font-size: 10px;
  }
  .mobile-nav-icon {
    width: 21px;
    height: 21px;
  }
  .mobile-nav-badge {
    top: -6px;
    left: 14px;
    border-color: var(--bg2);
  }
  /* Mobile page headers are compact and aligned. */
  .page-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 1px 12px;
  }
  .page-heading > div {
    min-width: 0;
    flex: 1;
  }
  .page-heading .eyebrow {
    display: none;
  }
  .page-heading h1 {
    margin: 0 0 3px;
    font-size: 23px;
  }
  .page-heading p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 12px;
    line-height: 1.35;
  }
  .page-heading > .btn {
    flex: 0 0 auto;
    min-height: 40px;
    padding-inline: 11px;
  }
  /* DMs are a native list on a phone rather than cards inside cards. */
  .dm-inbox {
    gap: 13px;
  }
  .dm-message-section .section-head,
  .dm-request-section .section-head {
    padding-inline: 2px;
    margin-bottom: 5px;
  }
  .dm-list-card {
    margin-inline: -12px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    background: transparent;
  }
  .dm-list-card .dm-row {
    margin: 0;
    padding: 10px 12px;
    border-bottom: 1px solid color-mix(in srgb, var(--line), transparent 32%);
    border-radius: 0;
  }
  .dm-list-card .dm-row:last-child {
    border-bottom: 0;
  }
  .dm-list-card .dm-row:hover,
  .dm-list-card .dm-row.active {
    border-color: color-mix(in srgb, var(--line), transparent 32%);
  }
  .message-request-row {
    align-items: center;
  }
  .request-actions {
    gap: 5px;
  }
  .request-actions .btn {
    min-height: 38px;
    padding-inline: 10px;
  }
  /* Friends tabs scroll like a native segmented section selector. */
  .friends-toolbar {
    display: block;
    margin-inline: -12px;
    padding: 7px 12px 0;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
  }
  .friends-toolbar > h2 {
    margin: 4px 0 8px;
    font-size: 23px;
  }
  .friends-tabs {
    display: flex;
    gap: 4px;
    margin-inline: -4px;
    padding: 0 4px 8px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  .friends-tabs::-webkit-scrollbar {
    display: none;
  }
  .friends-tab {
    min-height: 38px;
    flex: 0 0 auto;
    padding-inline: 12px;
    scroll-snap-align: start;
  }
  .friends-list {
    margin-inline: -12px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
  .friends-list .row {
    border-radius: 0;
  }
  .friend-actions {
    gap: 5px;
  }
  /* Forums lose the desktop hero treatment on phones. */
  .forum-directory-hero {
    display: block;
    padding: 4px 1px 13px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .forum-directory-hero .eyebrow {
    display: none;
  }
  .forum-directory-hero h2 {
    margin: 0 0 4px;
    font-size: 24px;
  }
  .forum-directory-hero .forum-header-actions {
    margin-top: 12px;
  }
  .forum-directory-hero .btn {
    width: auto;
    min-height: 40px;
  }
  .forum-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .forum-card {
    border-radius: 12px;
  }
  /* Home stops using horizontally clipped stats on very small devices. */
  .home-welcome {
    padding-top: 3px;
  }
  .home-welcome-copy h1 {
    font-size: 27px;
  }
  .home-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-inline: 0;
    padding: 0;
    overflow: visible;
  }
  .home-stat-grid .stat-card {
    min-width: 0;
    min-height: 88px;
    padding: 12px 10px;
  }
  .home-stat-grid .stat-value {
    font-size: 24px;
  }
  .home-stat-grid .stat-card b {
    font-size: 12px;
  }
  .home-stat-grid .stat-card small {
    display: none;
  }
  /* Chat is intentionally the densest phone view. */
  .route-chat .chat-header {
    min-height: calc(58px + env(safe-area-inset-top));
    padding: calc(7px + env(safe-area-inset-top)) 9px 7px;
  }
  .chat-header .grow small {
    max-width: 42vw;
  }
  .messages {
    padding-inline: 7px;
  }
  .msg {
    padding-inline: 5px;
  }
  .msg-body {
    overflow-wrap: anywhere;
  }
  .msg-actions[data-touch-actions=open],
  .msg[data-touch-actions=open] .msg-actions {
    display: flex;
  }
  .message-image {
    max-height: min(54dvh, 520px);
  }
  .link-embed {
    max-width: 100%;
  }
  .composer {
    gap: 6px;
    padding: 7px 7px max(8px, env(safe-area-inset-bottom));
  }
  .composer textarea {
    min-height: 46px;
    max-height: 34dvh;
    padding: 11px 12px;
  }
  .composer-footer {
    min-height: 42px;
  }
  .composer-action {
    width: 42px;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
  }
  .composer-action .ui-icon {
    width: 19px;
    height: 19px;
  }
  /* Settings are one-column, with the section rail always reachable. */
  .settings-mobile-nav {
    margin-inline: -12px;
    padding-bottom: 8px;
  }
  .settings-mobile-tab {
    min-height: 36px;
  }
  .settings-content-top {
    padding-inline: 1px;
  }
  .settings-content-top .eyebrow {
    display: none;
  }
  .settings-content-top h1 {
    margin: 0;
    font-size: 23px;
  }
  .settings-card {
    margin-inline: -12px;
    width: calc(100% + 24px);
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
  .settings-panel {
    padding-inline: 14px;
  }
  .settings-card-head {
    padding-top: 17px;
  }
  .setting-row {
    min-width: 0;
  }
  .setting-row:not(.setting-row-stack) > :first-child {
    min-width: 0;
  }
  .setting-row small {
    overflow-wrap: anywhere;
  }
  .appearance-choice-grid {
    gap: 7px;
  }
  .choice-card {
    min-height: 62px;
  }
  /* Full-height sheets remain reachable even on small browsers. */
  .modal-card,
  .action-modal,
  .account-dialog,
  .servers-sheet .servers-sheet-card {
    max-height: min(90dvh, var(--pw-visual-height, 90dvh));
    overscroll-behavior: contain;
  }
  .modal-body,
  .account-dialog-body,
  .servers-sheet .servers-sheet-card {
    -webkit-overflow-scrolling: touch;
  }
  .auth-form-panel {
    min-height: 100dvh;
    padding-inline: 20px;
  }
  .auth-mobile-brand {
    margin-bottom: 30px;
  }
  .auth-heading h2 {
    font-size: 28px;
  }
  .auth-instance-meta {
    padding-bottom: 8px;
  }
}
@media (max-width: 410px) {
  .home-stat-grid {
    gap: 6px;
  }
  .home-stat-grid .stat-card {
    padding-inline: 8px;
  }
  .home-stat-grid .stat-card b {
    font-size: 11px;
  }
  .home-primary-actions {
    grid-template-columns: 1fr;
  }
  .request-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .request-actions .btn {
    width: 100%;
  }
}
@media (max-width: 760px) and (orientation: landscape) and (max-height: 500px) {
  .auth-form-panel {
    padding-top: 18px;
  }
  .auth-mobile-brand {
    margin-bottom: 16px;
  }
  .modal-card,
  .action-modal,
  .account-dialog {
    max-height: 96dvh;
  }
}
/* KLIPY GIF picker -------------------------------------------------------- */
.gif-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: grid;
  place-items: center;
  padding: 18px;
  background: color-mix(in srgb, #000 48%, transparent);
  backdrop-filter: blur(5px);
}

.gif-picker-shell {
  width: min(720px, 100vw - 28px);
  max-height: min(760px, 100vh - 36px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

.gif-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gif-picker-head > div {
  display: grid;
  gap: 2px;
}

.gif-picker-head small {
  color: var(--muted);
}

.gif-picker-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.gif-picker-close:hover,
.gif-picker-close:focus-visible {
  background: var(--hover);
  color: var(--text);
}

.gif-picker-search {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input, var(--surface));
  color: var(--text);
  padding: 0 13px;
  outline: none;
}

.gif-picker-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 19%, transparent);
}

.gif-picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.gif-picker-chips button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 5px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.gif-picker-chips button:hover {
  color: var(--text);
  background: var(--hover);
}

.gif-picker-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.86rem;
}

.gif-picker-grid {
  min-height: 180px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 55%, transparent) transparent;
}

.gif-picker-item {
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(95px, 1fr) auto;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.gif-picker-item:hover,
.gif-picker-item:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.gif-picker-item img {
  display: block;
  width: 100%;
  aspect-ratio: var(--gif-aspect, 4/3);
  min-height: 105px;
  max-height: 175px;
  object-fit: cover;
  background: var(--hover);
}

.gif-picker-item span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 7px 8px 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.gif-picker-footer {
  display: flex;
  justify-content: center;
  min-height: 38px;
  padding-top: 2px;
}

.gif-picker-more[hidden] {
  display: none;
}

.gif-picker-more {
  min-width: 126px;
}

.wire-created-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.wire-created-result input {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 9px 10px;
}

.wire-row.inactive {
  opacity: 0.62;
}

.wire-row-identity {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.wire-row-identity code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wire-row-identity small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-action-gif {
  display: inline-grid;
  place-items: center;
  min-width: 25px;
  height: 18px;
  padding: 0 3px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

@media (max-width: 720px) {
  .gif-picker-backdrop {
    padding: 0;
    place-items: end center;
  }
  .gif-picker-shell {
    width: 100%;
    max-height: min(78vh, 680px);
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
  .gif-picker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.fallback-context-menu {
  position: fixed;
  z-index: 2100;
  min-width: 190px;
  padding: 6px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.28);
}

.fallback-context-menu button {
  width: 100%;
  border: 0;
  border-radius: 7px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.fallback-context-menu button:hover,
.fallback-context-menu button:focus-visible {
  background: var(--hover);
  outline: none;
}

.fallback-context-menu button:disabled {
  opacity: 0.42;
  cursor: default;
}

/* Server/group administration and moderation surfaces. These are intentionally
   composed from the same tokens/buttons as the rest of Plainwire. */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9800;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 7, 12, 0.72);
  backdrop-filter: blur(8px);
}

.admin-modal-shell {
  width: min(920px, 96vw);
  max-height: min(840px, 92vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg2);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  outline: none;
}

.admin-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}
.admin-modal-head h2 {
  margin: 0;
  font-size: 20px;
}
.admin-modal-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-modal-close {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: 24px/1 system-ui;
  cursor: pointer;
}
.admin-modal-close:hover, .admin-modal-close:focus-visible {
  background: var(--hover);
  color: var(--text);
  outline: none;
}

.admin-modal-body {
  min-height: 0;
  overflow: auto;
  padding: 18px 22px 22px;
}

.admin-tabs {
  position: sticky;
  top: -18px;
  z-index: 2;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  margin: -18px -22px 18px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg2) 94%, transparent);
  backdrop-filter: blur(12px);
}
.admin-tabs button {
  appearance: none;
  border: 0;
  border-radius: 9px;
  padding: 8px 11px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.admin-tabs button:hover, .admin-tabs button:focus-visible {
  background: var(--hover);
  color: var(--text);
  outline: none;
}
.admin-tabs button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.admin-panel, .admin-form-stack, .admin-role-stack {
  display: grid;
  gap: 14px;
}

.admin-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.admin-field input, .admin-field textarea, .admin-role-create input, .wire-create-controls input, .wire-create-controls select,
.admin-role-card input[type=text], .admin-role-card input[type=number] {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg3, var(--bg));
  color: var(--text);
  padding: 10px 11px;
  font: inherit;
  font-size: 14px;
  outline: none;
}
.admin-field input:focus, .admin-field textarea:focus, .admin-role-create input:focus, .wire-create-controls input:focus, .wire-create-controls select:focus,
.admin-role-card input[type=text]:focus, .admin-role-card input[type=number]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.admin-field input:disabled, .admin-field textarea:disabled, .admin-role-create input:disabled, .wire-create-controls input:disabled, .wire-create-controls select:disabled,
.admin-role-card input[type=text]:disabled, .admin-role-card input[type=number]:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.admin-field textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.45;
}

.admin-field input[type=color], .admin-role-create input[type=color] {
  width: 48px;
  height: 38px;
  padding: 3px;
  cursor: pointer;
}

.admin-inline-message {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--hover);
  font-size: 13px;
}

.admin-inline-message.muted {
  color: var(--muted);
}

.admin-inline-message.error {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.admin-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg3, var(--bg));
}
.admin-summary span {
  color: var(--muted);
  font-size: 13px;
}

.admin-role-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.admin-role-card, .admin-member-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg3, var(--bg)) 78%, transparent);
}

.admin-role-card > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin: -4px;
  padding: 4px;
  border-radius: 9px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.admin-role-card > summary::-webkit-details-marker {
  display: none;
}
.admin-role-card > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.admin-role-card > summary > i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.admin-role-card > summary > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 720;
}
.admin-role-card > summary > small {
  color: var(--muted);
  font-size: 11px;
}

.admin-role-editor {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.admin-default-permissions {
  gap: 11px;
}

.admin-default-permissions-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.admin-default-permissions-head strong, .admin-default-permissions-head small {
  display: block;
}
.admin-default-permissions-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.admin-role-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px 90px;
  gap: 8px;
  align-items: center;
}

.admin-permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.admin-permission {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--hover);
  cursor: pointer;
}
.admin-permission input {
  margin-top: 3px;
}
.admin-permission strong, .admin-permission small {
  display: block;
}
.admin-permission small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.admin-member-list {
  display: grid;
  gap: 9px;
}

.admin-member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.admin-member-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  object-fit: cover;
  background: var(--hover);
  color: var(--muted);
  font-weight: 750;
}

.admin-member-copy {
  min-width: 0;
  flex: 1;
}
.admin-member-copy strong, .admin-member-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-member-copy small {
  margin-top: 2px;
  color: var(--muted);
}

.admin-member-name {
  min-width: 0;
  flex: 1;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.admin-member-name strong, .admin-member-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-member-name span {
  color: var(--muted);
  font-size: 12px;
}
.admin-member-name:hover strong {
  text-decoration: underline;
}

.admin-member-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  padding-top: 2px;
}
.admin-member-roles label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.wire-create-controls {
  display: grid;
  grid-template-columns: minmax(130px, 0.6fr) minmax(100px, 0.4fr) auto;
  gap: 8px;
  align-items: center;
}

.wire-list {
  display: grid;
  gap: 8px;
}

.wire-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg3, var(--bg));
}
.wire-row code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wire-row span {
  color: var(--muted);
  font-size: 12px;
}

.group-members-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.group-manage-btn {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 11px;
}

.group-moderator {
  font-size: 9px;
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.server-member-role {
  font-weight: 650;
}

.thread-action-btn, .thread-delete-btn {
  appearance: none;
  border: 0;
  border-radius: 7px;
  padding: 4px 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.thread-action-btn:hover, .thread-action-btn:focus-visible, .thread-delete-btn:hover, .thread-delete-btn:focus-visible {
  background: var(--hover);
  color: var(--text);
  outline: none;
}

.thread-delete-btn:hover, .thread-delete-btn:focus-visible {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.reply-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.icon-btn .call-icon, .call-bar-controls .call-icon, .call-overlay-controls .call-icon {
  display: block;
  margin: auto;
  transform: translateY(0);
}

.call-icon-audio {
  transform-origin: center;
}

@media (max-width: 680px) {
  .admin-modal-backdrop {
    padding: 0;
    align-items: end;
  }
  .admin-modal-shell {
    width: 100%;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
  }
  .admin-modal-body {
    padding: 14px;
  }
  .admin-tabs {
    top: -14px;
    margin: -14px -14px 14px;
    padding: 10px 14px;
  }
  .admin-permission-grid {
    grid-template-columns: 1fr;
  }
  .admin-role-head, .admin-role-create, .wire-create-controls, .wire-row {
    grid-template-columns: 1fr;
  }
  .admin-member-row {
    align-items: flex-start;
  }
}
/* Discord-like DM close affordance: unobtrusive until hover/focus. */
.dm-row-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
}

.dm-close {
  width: 1.45rem;
  height: 1.45rem;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  opacity: 0;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.dm-row:hover .dm-close, .dm-row:focus-within .dm-close, .dm-close:focus-visible {
  opacity: 1;
}

.dm-close:hover, .dm-close:focus-visible {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 10%, transparent);
  outline: none;
}

/* --------------------------------------------------------------------------
   Realtime typing + first-run Plainwire guide
   -------------------------------------------------------------------------- */
pw-typing-indicator {
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(2px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}
pw-typing-indicator.is-active {
  opacity: 1;
  transform: translateY(0);
}
pw-typing-indicator .typing-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 12px;
  flex: 0 0 auto;
}
.typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.46;
  animation: pw-typing-dot 1s ease-in-out infinite;
}
.typing-dots i:nth-child(2) {
  animation-delay: 0.12s;
}
.typing-dots i:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes pw-typing-dot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.42;
  }
  30% {
    transform: translateY(-3px);
    opacity: 0.95;
  }
}
.pw-onboarding-entry {
  display: block;
  margin: 2px 0 5px;
}
.pw-onboarding-entry[hidden] {
  display: none !important;
}

.pw-onboarding-entry-button {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text1);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}
.pw-onboarding-entry-button:hover, .pw-onboarding-entry-button:focus-visible {
  background: color-mix(in srgb, var(--accent), transparent 90%);
  border-color: color-mix(in srgb, var(--accent), transparent 68%);
  outline: none;
}
.pw-onboarding-entry-button:active {
  transform: scale(0.985);
}

.pw-onboarding-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--accent), white 12%);
  border-radius: 12px;
  background: radial-gradient(circle at 32% 20%, color-mix(in srgb, var(--accent), white 24%), transparent 42%), var(--accent);
  color: white;
  box-shadow: 0 7px 18px color-mix(in srgb, var(--accent), transparent 74%);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 1;
  user-select: none;
}
.pw-onboarding-mark.compact {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 16px;
}

.pw-onboarding-entry-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pw-onboarding-entry-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.pw-onboarding-entry-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}

.pw-onboarding-unread {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 84%);
}

.pw-onboarding-entry-inbox {
  margin: 0 0 18px;
}
.pw-onboarding-entry-inbox .pw-onboarding-entry-button {
  min-height: 82px;
  padding: 13px 15px;
  border-color: color-mix(in srgb, var(--accent), transparent 68%);
  background: linear-gradient(115deg, color-mix(in srgb, var(--accent), transparent 91%), transparent 60%), var(--bg2);
  box-shadow: 0 9px 26px rgba(0, 0, 0, 0.08);
}
.pw-onboarding-entry-inbox .pw-onboarding-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
}
.pw-onboarding-entry-inbox .pw-onboarding-entry-copy strong {
  font-size: 15px;
}

.pw-onboarding-entry-description {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
}

.pw-onboarding-entry.is-hopping .pw-onboarding-mark {
  animation: pw-onboarding-hop 0.82s cubic-bezier(0.22, 0.88, 0.36, 1.12);
}

@keyframes pw-onboarding-hop {
  0%, 100% {
    transform: translateY(0) rotate(0);
  }
  24% {
    transform: translateY(-9px) rotate(-3deg);
  }
  48% {
    transform: translateY(1px) rotate(2deg);
  }
  66% {
    transform: translateY(-4px) rotate(-1deg);
  }
}
.pw-onboarding-chat-layer {
  position: absolute;
  inset: 0;
  z-index: 130;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: radial-gradient(circle at 72% 18%, color-mix(in srgb, var(--accent), transparent 94%), transparent 34%), var(--bg);
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.pw-onboarding-chat-layer.is-open {
  opacity: 1;
  transform: translateY(0);
}

.pw-onboarding-chat-head {
  min-height: 68px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg), transparent 4%);
  backdrop-filter: blur(14px);
}
.pw-onboarding-chat-head h2 {
  margin: 0;
  font-size: 16px;
}
.pw-onboarding-chat-head small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.pw-onboarding-messages {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: clamp(22px, 5vw, 54px) max(22px, (100% - 780px) / 2);
  scroll-padding-bottom: 30px;
}
.pw-onboarding-messages > pw-typing-indicator {
  order: 999;
  margin: 5px 0 0 50px;
}

.pw-tour-message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  max-width: 720px;
  animation: pw-tour-message-in 0.26s cubic-bezier(0.22, 0.85, 0.32, 1);
}

.pw-tour-message-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-weight: 900;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--accent), transparent 78%);
}

.pw-tour-message-body {
  min-width: 0;
  padding-top: 1px;
}
.pw-tour-message-body > strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}
.pw-tour-message-body p {
  display: inline-block;
  max-width: min(640px, 100%);
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px 13px 13px;
  background: var(--bg2);
  color: var(--text1);
  line-height: 1.52;
}

@keyframes pw-tour-message-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.pw-onboarding-actions {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg2);
}

.pw-tour-complete {
  margin-right: auto;
  color: var(--good, #43b581);
  font-size: 13px;
  font-weight: 700;
}

.pw-tour-source-card {
  max-width: 720px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  margin: 12px 0 6px 50px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 68%);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent), transparent 94%);
}
.pw-tour-source-card strong, .pw-tour-source-card small {
  display: block;
}
.pw-tour-source-card small {
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.pw-tour-source-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--bg3);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.pw-tour-source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.pw-tour-spotlight {
  position: fixed;
  z-index: 220;
  border: 2px solid color-mix(in srgb, var(--accent), white 12%);
  border-radius: 13px;
  box-shadow: 0 0 0 9999px rgba(4, 6, 10, 0.52), 0 0 0 5px color-mix(in srgb, var(--accent), transparent 82%), 0 8px 28px color-mix(in srgb, var(--accent), transparent 72%);
  pointer-events: none;
  transition: left 0.18s ease, top 0.18s ease, width 0.18s ease, height 0.18s ease;
}

.pw-tour-guide {
  position: fixed;
  z-index: 230;
  top: 18px;
  right: 18px;
  width: min(390px, 100vw - 36px);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 58%);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg2), transparent 2%);
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateY(-10px) scale(0.975);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.28s cubic-bezier(0.22, 0.85, 0.32, 1.08);
}
.pw-tour-guide.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.pw-tour-guide-head {
  min-height: 56px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent), transparent 94%);
}
.pw-tour-guide-head strong, .pw-tour-guide-head small {
  display: block;
}
.pw-tour-guide-head strong {
  font-size: 13px;
}
.pw-tour-guide-head small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.pw-tour-guide-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: 600 20px/1 system-ui, sans-serif;
  cursor: pointer;
}
.pw-tour-guide-close:hover, .pw-tour-guide-close:focus-visible {
  background: var(--hover);
  color: var(--text1);
  outline: none;
}

.pw-tour-guide-body {
  min-height: 136px;
  padding: 15px 16px 12px;
}
.pw-tour-guide-body h3 {
  margin: 0 0 7px;
  font-size: 16px;
  line-height: 1.25;
}
.pw-tour-guide-body p {
  margin: 0;
  color: var(--text1);
  font-size: 13px;
  line-height: 1.52;
}
.pw-tour-guide-body > pw-typing-indicator {
  margin-top: 8px;
}

.pw-tour-guide-hint {
  display: block;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.pw-tour-guide-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  padding: 10px 11px;
  border-top: 1px solid var(--line);
}
.pw-tour-guide-actions .btn.ghost {
  margin-right: auto;
}

@media (max-width: 760px) {
  .pw-tour-guide {
    top: auto;
    right: 10px;
    bottom: calc(var(--mobile-nav-h, 64px) + env(safe-area-inset-bottom) + 10px);
    width: calc(100vw - 20px);
    max-height: min(62dvh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform-origin: bottom center;
  }
  .pw-tour-guide.is-top {
    top: calc(10px + env(safe-area-inset-top));
    bottom: auto;
    transform-origin: top center;
  }
  .pw-onboarding-chat-layer {
    z-index: 190;
    min-height: 0;
  }
  .pw-onboarding-chat-head {
    min-height: 60px;
    padding: 9px 12px;
    padding-top: calc(9px + env(safe-area-inset-top));
  }
  .pw-onboarding-messages {
    padding: 16px 12px 22px;
    overscroll-behavior: contain;
  }
  .pw-onboarding-actions {
    justify-content: stretch;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }
  .pw-onboarding-actions .btn {
    flex: 1 1 120px;
  }
  .pw-tour-message {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 9px;
  }
  .pw-tour-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }
  .pw-tour-message-body p {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .pw-tour-source-card {
    grid-template-columns: auto minmax(0, 1fr);
    margin-left: 0;
    padding: 12px;
  }
  .pw-tour-source-actions {
    grid-column: 1/-1;
    justify-content: stretch;
  }
  .pw-tour-source-actions .btn {
    flex: 1 1 130px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .typing-dots i,
  .pw-onboarding-entry.is-hopping .pw-onboarding-mark,
  .pw-tour-message {
    animation: none !important;
  }
  .pw-tour-spotlight,
  .pw-tour-guide,
  .pw-onboarding-chat-layer {
    transition-duration: 0.01ms !important;
  }
}
html[data-reduce-motion=true] .typing-dots i,
html[data-reduce-motion=true] .pw-onboarding-entry.is-hopping .pw-onboarding-mark,
html[data-reduce-motion=true] .pw-tour-message {
  animation: none !important;
}
html[data-reduce-motion=true] .pw-tour-spotlight,
html[data-reduce-motion=true] .pw-tour-guide,
html[data-reduce-motion=true] .pw-onboarding-chat-layer {
  transition-duration: 0.01ms !important;
}

/* 1.7.5 stability polish: friend state stays legible while a degraded sync
   recovers, and image boxes paint immediately instead of flashing empty. */
.friends-title {
  min-width: 132px;
  display: grid;
  gap: 2px;
}

.friends-title h2 {
  margin: 0;
}

.friends-title small {
  font-size: 11px;
  white-space: nowrap;
}

.friends-tabs .tab-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text2), transparent 88%);
  color: var(--text2);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.friends-tab.active .tab-count {
  background: color-mix(in srgb, var(--accent), transparent 80%);
  color: var(--text1);
}

img.avatar, .server-icon img {
  background: var(--bg4);
  transition: opacity 120ms ease;
}

img.avatar.image-failed, .server-icon img.image-failed {
  opacity: 1;
}

@media (max-width: 720px) {
  .friends-title {
    min-width: 0;
  }
  .friends-title small {
    white-space: normal;
  }
}
/* Hosted-instance announcements. Kept outside Elm so service operators can
   publish/retire banners in realtime without coupling them to a page route. */
:root {
  --pw-global-banner-offset: 0px;
}

#app {
  height: calc(100vh - var(--pw-global-banner-offset));
  height: calc(100dvh - var(--pw-global-banner-offset));
  margin-top: var(--pw-global-banner-offset);
}

.pw-global-banner-stack {
  position: fixed;
  z-index: 12000;
  inset: 0 0 auto 0;
  display: grid;
  gap: 1px;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--line, rgba(120, 128, 138, 0.22));
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

.pw-global-banner {
  --banner-tone: var(--accent, #7b83ff);
  min-height: 42px;
  display: grid;
  grid-template-columns: 3px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 8px max(14px, env(safe-area-inset-right, 0px)) 8px max(14px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--bg2, #171a1f) 96%, var(--banner-tone) 4%);
  color: var(--text, #eef0f3);
  font-size: 12px;
  line-height: 1.35;
}

.pw-global-banner.success {
  --banner-tone: #67b68b;
}

.pw-global-banner.warning {
  --banner-tone: #d6a54a;
}

.pw-global-banner.critical {
  --banner-tone: #d7636e;
}

.pw-global-banner-marker {
  width: 3px;
  height: 24px;
  border-radius: 99px;
  background: var(--banner-tone);
}

.pw-global-banner-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.pw-global-banner-copy strong {
  color: var(--text, #eef0f3);
  font-size: 12px;
  font-weight: 720;
}

.pw-global-banner-copy > span {
  min-width: 0;
  color: var(--muted, #a2a8b0);
  overflow-wrap: anywhere;
}

.pw-global-banner-link {
  color: var(--text, #eef0f3);
  font-weight: 680;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pw-global-banner-close {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted, #a2a8b0);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.pw-global-banner-close:hover, .pw-global-banner-close:focus-visible {
  background: var(--bg3, rgba(255, 255, 255, 0.06));
  color: var(--text, #eef0f3);
}

@media (max-width: 640px) {
  .pw-global-banner {
    align-items: start;
    padding-block: 9px;
  }
  .pw-global-banner-copy {
    display: grid;
    gap: 2px;
  }
  .pw-global-banner-marker {
    margin-top: 1px;
  }
}
/* Calls: a compact utility window, not a glowing overlay. */
.call-layer {
  right: 18px;
  bottom: 18px;
  gap: 8px;
  filter: none;
  transition: none;
}

.call-layer.detached {
  right: auto;
  bottom: auto;
}

.call-layer.dragging {
  user-select: none;
}

.call-layer.dragging > * {
  pointer-events: none;
}

.call-popup,
.call-bar.compact,
.call-overlay.expanded {
  width: 376px;
  max-width: calc(100vw - 24px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: none;
  animation: none;
}

.call-popup {
  padding: 14px;
}

.call-popup.incoming,
.call-popup.outgoing {
  border-color: var(--line);
}

.call-popup-head {
  margin: -4px -4px 12px;
  padding: 4px;
  cursor: grab;
  touch-action: none;
}

.call-popup-head:active {
  cursor: grabbing;
}

.call-ring {
  display: none;
}

.call-avatar-wrap {
  position: relative;
}

.call-avatar-wrap::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  border: 2px solid var(--bg2);
  border-radius: 50%;
  background: var(--ok);
}

.call-popup-title {
  font-size: 15px;
  font-weight: 700;
}

.call-popup-sub {
  font-size: 12px;
}

.call-popup-actions {
  gap: 7px;
}

.call-popup-actions .btn {
  min-height: 36px;
}

.call-bar.compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
  cursor: default;
}

.call-bar.compact:hover {
  transform: none;
  border-color: var(--line);
}

.call-bar-drag-area {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 3px 5px;
  border-radius: 7px;
  cursor: grab;
  touch-action: none;
}

.call-bar-drag-area:hover {
  background: var(--hover-soft);
}

.call-bar-drag-area:active {
  cursor: grabbing;
}

.call-bar-icon,
.call-overlay-icon,
.dm-call-bar-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1px solid color-mix(in srgb, var(--ok), transparent 62%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--ok), transparent 88%);
  color: var(--ok);
  box-shadow: none;
  animation: none;
}

.call-bar-icon .call-icon,
.call-overlay-icon .call-icon,
.dm-call-bar-icon .call-icon {
  width: 16px;
  height: 16px;
}

.call-bar-title {
  font-size: 13px;
  font-weight: 700;
}

.call-bar-sub {
  display: block;
  max-width: 190px;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.call-bar-avatars .avatar.small {
  width: 26px;
  height: 26px;
  border: 2px solid var(--bg2);
}

.call-bar-controls {
  gap: 4px;
}

.call-bar-controls .btn.icon-btn,
.call-minimize {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 8px;
  background: var(--bg3);
  border-color: var(--line);
}

.call-bar-controls .btn.icon-btn:hover,
.call-minimize:hover {
  background: var(--hover);
}

.call-bar-controls .call-decline {
  background: color-mix(in srgb, var(--danger), transparent 86%) !important;
  border-color: color-mix(in srgb, var(--danger), transparent 55%) !important;
  color: #f26b70 !important;
}

.share-active {
  background: color-mix(in srgb, var(--ok), transparent 86%) !important;
  border-color: color-mix(in srgb, var(--ok), transparent 55%) !important;
  color: var(--ok) !important;
}

.call-overlay.expanded {
  overflow: hidden;
}

.call-overlay-header {
  min-height: 58px;
  padding: 9px 10px 9px 12px;
  border-bottom: 1px solid var(--line);
  cursor: grab;
  touch-action: none;
}

.call-overlay-header:active {
  cursor: grabbing;
}

.call-overlay-heading {
  min-width: 0;
  flex: 1;
}

.call-overlay-title {
  gap: 8px;
  color: var(--text1);
  font-size: 14px;
  font-weight: 700;
}

.call-overlay-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 0 38px;
  color: var(--muted);
  font-size: 11px;
}

.call-connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.call-overlay-timer {
  font-size: 11px;
}

.call-minimize-icon {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
}

.call-minimize-icon::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.call-sharing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 11px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ok), transparent 94%);
  color: var(--text2);
  font-size: 12px;
}

.call-sharing-row .call-icon {
  color: var(--ok);
}

.call-sharing-row > span:not(.call-icon) {
  flex: 1;
}

.call-sharing-row .btn {
  min-height: 28px;
  padding-inline: 8px;
  font-size: 11px;
}

.call-overlay-users {
  max-height: 220px;
  padding: 6px;
  background: var(--bg2);
}

.call-user-row {
  gap: 9px;
  min-height: 48px;
  padding: 7px 8px;
  border-radius: 7px;
}

.call-user-row:hover {
  background: var(--hover-soft);
}

.call-user-row .avatar.small {
  width: 32px;
  height: 32px;
}

.call-user-row .avatar.live {
  outline: none;
}

.call-user-name {
  font-size: 13px;
  font-weight: 650;
}

.call-user-status {
  font-size: 11px;
}

.call-retry {
  border-radius: 7px;
}

.call-overlay-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 9px;
  border-top: 1px solid var(--line);
  background: var(--bg3);
}

.call-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 39px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--text2);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.call-control:hover {
  background: var(--hover);
  color: var(--text1);
}

.call-control.active {
  border-color: color-mix(in srgb, var(--accent), transparent 52%);
  background: color-mix(in srgb, var(--accent), transparent 90%);
  color: var(--text1);
}

.call-control.danger,
.call-control.leave {
  border-color: color-mix(in srgb, var(--danger), transparent 52%);
  background: color-mix(in srgb, var(--danger), transparent 90%);
  color: #f07d82;
}

.call-control.leave:hover {
  background: color-mix(in srgb, var(--danger), transparent 82%);
}

.dm-call-bar {
  min-height: 44px;
  padding: 6px 12px;
  background: color-mix(in srgb, var(--ok), transparent 94%);
  border-bottom-color: color-mix(in srgb, var(--ok), transparent 72%);
  box-shadow: none;
}

.dm-call-bar-icon {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
}

.dm-call-bar-title {
  font-size: 13px;
}

.dm-call-bar-timer,
.dm-call-bar-count {
  font-size: 11px;
}

/* Screen share window: familiar desktop media window, still draggable/resizable. */
.pw-float {
  min-width: 300px;
  min-height: 190px;
  border: 1px solid #34373c;
  border-radius: 10px;
  background: #0b0c0e;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
  resize: both;
}

.pw-float::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 9px;
  height: 9px;
  border-right: 2px solid rgba(255, 255, 255, 0.34);
  border-bottom: 2px solid rgba(255, 255, 255, 0.34);
  pointer-events: none;
}

.pw-float-bar {
  min-height: 42px;
  padding: 5px 6px 5px 11px;
  gap: 8px;
  border-bottom: 1px solid #34373c;
  background: #202226;
  cursor: grab;
}

.pw-float-bar:active {
  cursor: grabbing;
}

.pw-float-title-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.pw-float-title {
  min-width: 0;
  flex: 0 1 auto;
  color: #f2f3f5;
  font-size: 12px;
  font-weight: 650;
}

.pw-float-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #a7abb2;
  font-size: 10px;
  font-weight: 600;
}

.pw-float-state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3ba55d;
}

.pw-float-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pw-float-btn {
  width: 30px;
  height: 28px;
  border-radius: 6px;
  color: #c8cbd0;
}

.pw-float-btn:hover {
  background: #32353a;
  color: #fff;
}

.pw-float-close:hover {
  background: #b83b41;
  color: #fff;
}

.pw-float-window-icon {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
}

.pw-float-window-icon.fit::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.pw-float-window-icon.fit::after {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 14px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0.45);
}

.pw-float-window-icon.fullscreen::before,
.pw-float-window-icon.fullscreen::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-color: currentColor;
}

.pw-float-window-icon.fullscreen::before {
  left: 1px;
  top: 1px;
  border-left: 1.5px solid currentColor;
  border-top: 1.5px solid currentColor;
  box-shadow: 7px 0 0 -1px transparent;
}

.pw-float-window-icon.fullscreen::after {
  right: 1px;
  bottom: 1px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
}

.pw-float-window-icon.close::before,
.pw-float-window-icon.close::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 1px;
  width: 1.5px;
  height: 12px;
  background: currentColor;
  transform: rotate(45deg);
}

.pw-float-window-icon.close::after {
  transform: rotate(-45deg);
}

.pw-float video {
  height: calc(100% - 42px);
  min-height: 148px;
  background: #0b0c0e;
}

/* Phone: calls are bottom sheets, screen shares are compact media viewers. */
@media (max-width: 760px) {
  .layout {
    padding-bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
  }
  .call-layer {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom) + 8px) !important;
    width: auto;
    max-height: calc(100dvh - var(--mobile-nav-h) - env(safe-area-inset-bottom) - 20px);
  }
  .call-layer.detached {
    left: 8px !important;
    right: 8px !important;
  }
  .call-popup,
  .call-bar.compact,
  .call-overlay.expanded {
    width: 100%;
    max-width: none;
    border-radius: 11px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
  }
  .call-popup-head,
  .call-bar-drag-area,
  .call-overlay-header {
    cursor: default;
    touch-action: auto;
  }
  .call-bar.compact {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .call-bar-avatars {
    display: none;
  }
  .call-bar-sub {
    max-width: 42vw;
  }
  .call-bar-controls .btn.icon-btn {
    width: 38px;
    height: 38px;
    min-height: 38px;
  }
  .call-overlay-users {
    max-height: min(34dvh, 250px);
  }
  .call-overlay-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .call-control {
    min-height: 44px;
    padding-inline: 5px;
  }
  .call-control span:last-child {
    font-size: 10px;
  }
  .pw-float {
    left: 7px !important;
    right: 7px !important;
    top: auto !important;
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom) + 8px) !important;
    width: auto !important;
    height: min(54dvh, 380px) !important;
    min-width: 0;
    min-height: 210px;
    max-width: none !important;
    max-height: 62dvh !important;
    border-radius: 10px;
    resize: none;
  }
  .pw-float::after {
    display: none;
  }
  .pw-float-bar {
    cursor: default;
    touch-action: auto;
  }
  .pw-float-state {
    display: none;
  }
  /* Tighten visual hierarchy on mobile without hiding functionality. */
  .content {
    padding-inline: 10px;
  }
  .home-welcome {
    align-items: flex-start;
    padding: 4px 1px 13px;
  }
  .home-welcome-copy h1 {
    font-size: 25px;
  }
  .home-primary-actions {
    width: 100%;
    justify-content: stretch;
  }
  .home-primary-actions .btn {
    flex: 1;
  }
  .home-stat-grid {
    gap: 6px;
  }
  .home-stat-grid .stat-card {
    min-height: 82px;
    border-radius: 9px;
  }
  .chat-surface {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .route-chat .content {
    padding: 0;
  }
  .route-chat .chat-header {
    border-radius: 0;
  }
  .messages {
    padding-inline: 6px;
  }
  .msg {
    border-radius: 6px;
  }
  .composer {
    border-radius: 0;
  }
  .settings-card {
    border-radius: 0;
  }
  .settings-mobile-tab {
    border-radius: 7px;
  }
  .auth-form-panel {
    padding-inline: 18px;
  }
  .auth-form-wrap {
    width: min(390px, 100%);
  }
}
@media (max-width: 390px) {
  .call-overlay-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .call-bar-sub {
    max-width: 36vw;
  }
  .pw-float-btn {
    width: 34px;
    height: 32px;
  }
}
.pw-float-btn.active {
  background: #383c42;
  color: #fff;
}

/* Call controls: four clear actions, devices and input feedback in reach. */
.call-overlay.expanded {
  width: 384px;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1254901961);
}

.call-overlay-header {
  min-height: 72px;
  padding: 14px 16px;
}

.call-overlay-title {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.call-overlay-meta {
  margin: 6px 0 0;
  font-size: 12px;
}

.call-connection-dot {
  background: var(--muted);
}

.call-connection-dot.connected {
  background: var(--ok);
}

.call-bar-drag-area {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
}

.call-bar-info {
  min-width: 0;
}

.call-overlay-users {
  padding: 8px;
}

.call-user-row {
  min-height: 58px;
  padding: 9px 8px;
}

.call-user-name {
  font-size: 13px;
}

.call-user-status {
  font-size: 12px;
  margin-top: 3px;
}

.call-input-panel {
  margin: 0 16px 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--hover-soft);
}

.call-input-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.call-input-heading label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text1);
}

.call-mic-status {
  font-size: 11px;
  color: var(--text2);
}

.call-input-panel select {
  display: block;
  width: 100%;
  height: 34px;
  min-width: 0;
  border: 1px solid var(--line2);
  border-radius: 5px;
  background: var(--bg2);
  color: var(--text);
  padding: 0 8px;
  font: inherit;
  font-size: 12px;
}

.call-mic-meter {
  height: 4px;
  margin-top: 12px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--line);
}

.call-mic-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--ok);
  transition: width 0.1s linear;
}

.call-overlay-controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 12px 16px;
  gap: 8px;
  background: var(--bg2);
}

.call-control {
  min-height: 62px;
  flex-direction: column;
  gap: 7px;
  padding: 9px 4px;
  background: var(--bg3);
  font-size: 11px;
  font-weight: 600;
  border-radius: 8px;
}

.call-control .call-icon {
  width: 20px;
  height: 20px;
}

.call-control:active {
  transform: translateY(1px);
}

.call-control.leave {
  background: #ab3540;
  border-color: #ab3540;
  color: #fff;
}

.call-control.leave:hover {
  background: #922c36;
  border-color: #922c36;
  color: #fff;
}

.call-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px 10px;
}

.call-tools .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px;
  font-size: 11px;
  color: var(--text2);
}

.call-tools .ui-icon {
  width: 14px;
  height: 14px;
  min-width: 14px;
}

.call-popup-actions .btn {
  min-height: 42px;
  border-radius: 7px;
}

.call-popup-actions .call-accept {
  background: #237547 !important;
}

.call-popup-actions .call-accept:hover {
  background: #1d623b !important;
}

.call-bar-controls .call-decline {
  background: #ab3540 !important;
  border-color: #ab3540 !important;
  color: #fff !important;
}

.call-bar-controls .call-decline:hover {
  background: #922c36 !important;
}

.call-control.active {
  background: var(--active);
  color: var(--text1);
  border-color: var(--accent);
}

.call-bar-controls .btn.call-muted {
  background: var(--active) !important;
  color: var(--text1) !important;
  border-color: var(--accent) !important;
  opacity: 1;
}

@media (max-width: 760px) {
  .call-overlay.expanded {
    width: 100%;
  }
  .call-overlay-header {
    min-height: 66px;
    padding: 12px 14px;
  }
  .call-overlay-users {
    max-height: min(25dvh, 220px);
    overflow-y: auto;
  }
  .call-input-panel {
    margin: 0 12px 12px;
  }
  .call-overlay-controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 12px;
  }
  .call-control {
    min-height: 62px;
  }
  .call-control span:last-child {
    font-size: 11px;
  }
  .call-tools .btn {
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .call-mic-fill {
    transition: none;
  }
}
.call-health {
  margin: 0 16px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg2);
  font-size: 12px;
}

.call-health summary {
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text1);
}

.call-health-peer {
  margin: 0 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.call-health-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.call-health-status {
  color: var(--text2);
}

.call-health-status.good {
  color: var(--ok);
}

.call-health-status.poor {
  color: var(--danger);
}

.call-health-metrics {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  margin: 12px 0;
  font-size: 11px;
}

.call-health-metrics dt {
  color: var(--text2);
}

.call-health-metrics dd {
  margin: 0;
  color: var(--text1);
  font-variant-numeric: tabular-nums;
}

.call-health p {
  margin: 8px 0 0;
  color: var(--text2);
  font-size: 11px;
  line-height: 1.5;
}

.call-health .call-health-privacy {
  margin: 0;
  padding: 0 12px 12px;
}

.call-overlay.expanded {
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
}

@media (max-width: 760px) {
  .call-overlay.expanded {
    max-height: calc(100dvh - var(--mobile-nav-h) - env(safe-area-inset-bottom) - 24px);
  }
}
/* 1.7.5-2: make call requests read like part of the existing call utility,
   with clearer state hierarchy without turning them into a new overlay style. */
.call-popup-copy {
  min-width: 0;
  flex: 1;
}

.call-popup-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  color: var(--text2);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.call-popup-kicker .call-icon,
.call-popup-kicker .ui-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.call-popup-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-popup-sub {
  max-width: 34ch;
  margin-top: 3px;
  line-height: 1.45;
}

.call-popup.incoming .call-avatar-wrap::after {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok), transparent 78%);
}

@media (max-width: 520px) {
  .call-popup {
    padding: 12px;
  }
  .call-popup-head {
    align-items: flex-start;
  }
  .call-popup-sub {
    max-width: none;
  }
  .call-popup-actions .btn {
    min-height: 42px;
  }
}
/* Workspace design tokens and component layout. */
:root, [data-theme=light], [data-theme=dark] {
  --shell-gap: 0px;
  --shell-pad: 0px;
  --panel-radius: 0px;
  --control-radius: 6px;
  --card-radius: 9px;
  --rail-w: 64px;
  --side-w: 256px;
  --right-w: 228px;
}

:root, [data-theme=light] {
  --bg: #f5f6f7;
  --bg2: #ffffff;
  --bg3: #f0f2f4;
  --bg4: #e9edf0;
  --text: #323940;
  --text1: #1b242b;
  --text2: #606c76;
  --muted: #6b7782;
  --line: #e2e7eb;
  --line2: #cbd3da;
  --hover: #eaf0f4;
  --hover-soft: #f5f8fa;
  --active: #e3edf5;
  --accent: #326b98;
  --accent2: #28597f;
}

[data-theme=dark] {
  --bg: #202429;
  --bg2: #252a30;
  --bg3: #1c2025;
  --bg4: #181c20;
  --text: #d6dce2;
  --text1: #f2f4f6;
  --text2: #a4aeb8;
  --muted: #98a4af;
  --line: #343b43;
  --line2: #48535e;
  --hover: #303842;
  --hover-soft: #2a3037;
  --active: #2c4052;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=dark]):not([data-theme=light]) {
    --bg: #202429;
    --bg2: #252a30;
    --bg3: #1c2025;
    --bg4: #181c20;
    --text: #d6dce2;
    --text1: #f2f4f6;
    --text2: #a4aeb8;
    --muted: #98a4af;
    --line: #343b43;
    --line2: #48535e;
    --hover: #303842;
    --hover-soft: #2a3037;
    --active: #2c4052;
  }
}
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

button {
  font-weight: 550;
}

button:disabled {
  cursor: not-allowed;
}

:where(button, a, input, textarea, select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn {
  border-radius: var(--control-radius);
  box-shadow: none !important;
  min-height: 36px;
  font-size: 13px;
  transition: background-color 0.12s, border-color 0.12s;
}

.btn:hover, .btn:active {
  transform: none;
}

.btn.secondary, .btn.ghost {
  color: var(--text);
}

.btn.secondary {
  background: var(--bg2);
  border: 1px solid var(--line2);
}

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

.btn.ghost {
  background: transparent;
}

.field input, .field select, .field textarea, #globalSearch {
  border: 1px solid var(--line2);
  border-radius: 6px;
  box-shadow: none;
}

.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: none;
}

.card, .stat-card, .forum-card, .settings-card, .notifications-list, .search-result-section {
  border-radius: 9px;
  box-shadow: none;
}

.eyebrow {
  letter-spacing: 0.08em;
  font-size: 10px;
  font-weight: 650;
}

/* Contiguous panels keep navigation anchored and give messages the space. */
@media (min-width: 761px) {
  .layout {
    gap: 0;
    padding: 0;
    background: var(--bg2);
  }
  .rail {
    width: var(--rail-w);
    padding: 18px 0 12px;
    gap: 8px;
    border-radius: 0;
    border-right: 1px solid var(--line);
    background: var(--bg3);
    box-shadow: none;
  }
  .mark, .rail-btn {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }
  .rail-btn {
    background: transparent;
    color: var(--text2);
  }
  .rail-btn.active, .rail-btn:hover {
    background: var(--active);
    color: var(--accent);
    border-radius: 11px;
    box-shadow: none;
    transform: none;
  }
  .rail-btn .server-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }
  .mark {
    margin: 0 0 14px;
    background: var(--text1);
    color: var(--bg2);
    box-shadow: none;
  }
  .side {
    width: var(--side-w);
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: var(--bg);
    box-shadow: none;
  }
  .right {
    width: var(--right-w);
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
  }
  .main {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .topbar {
    height: 64px;
    min-height: 64px;
    padding: 0 28px;
    background: var(--bg2);
    border-radius: 0;
    border-bottom: 1px solid var(--line);
  }
  .topbar h2 {
    font-size: 16px;
    letter-spacing: -0.015em;
  }
  .topbar-title small {
    font-size: 11px;
  }
  .content {
    padding: 32px;
  }
  .route-chat .topbar {
    display: none;
  }
  .route-chat .content {
    padding: 0;
  }
}
.side-head {
  padding: 23px 18px 17px;
  background: transparent;
  border-bottom: 1px solid var(--line);
}

.side-head h1 {
  font-size: 16px;
  letter-spacing: -0.025em;
}

.side-head small {
  font-size: 11px;
}

.side-head .nav-actions {
  gap: 6px;
  margin-top: 13px;
}

.side-head .nav-actions .btn {
  font-size: 11px;
  min-height: 30px;
  padding-inline: 8px;
}

.side .row {
  border-radius: 6px;
}

.side .row.active, .side .dm-row.active {
  background: var(--active);
  color: var(--text1);
  box-shadow: inset 3px 0 var(--accent);
}

.side .dm-row {
  border-radius: 6px;
  min-height: 56px;
  padding: 10px;
}

.side .dm-row .avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
}

.dm-name {
  font-size: 13px;
  font-weight: 600;
}

.dm-preview {
  font-size: 12px;
}

.avatar {
  border-radius: 12px;
  background: var(--bg4);
  color: var(--text2);
  font-weight: 600;
}

.avatar img {
  border-radius: inherit;
}

/* Home is a short inbox, with useful counts and room to scan. */
.home-page {
  max-width: 1100px;
  margin-inline: auto;
}

.home-welcome {
  padding: 0 0 28px;
  margin: 0;
  background: transparent;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.home-welcome-copy h1 {
  font-size: clamp(27px, 3vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.04em;
  margin: 8px 0;
  font-weight: 650;
}

.home-welcome-copy p {
  font-size: 14px;
  color: var(--text2);
  margin: 0;
}

.home-primary-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.home-stat-grid {
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  margin-block: 24px;
  background: var(--bg2);
}

.home-stat-grid .stat-card {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  min-height: 105px;
  padding: 19px 22px;
  background: transparent;
}

.home-stat-grid .stat-card:last-child {
  border-right: 0;
}

.home-stat-grid .stat-value {
  font-size: 27px;
  letter-spacing: -0.04em;
}

.home-stat-grid .stat-card:hover {
  transform: none;
  background: var(--hover-soft);
}

.home-columns {
  gap: 22px;
}

.home-panel {
  padding: 0 !important;
  border: 0;
  background: transparent;
}

.home-panel .section-head {
  padding: 0 0 16px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.home-panel .section-head h2 {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.home-panel .section-head p {
  font-size: 12px;
}

.home-recent-list .dm-row, .home-activity-row {
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px 2px;
}

.home-empty {
  text-align: left;
  padding: 26px 0;
  font-size: 13px;
}

.home-quick-links {
  margin-top: 20px;
}

/* Conversation timeline and one composer surface. */
.chat-surface {
  border: 0;
  border-radius: 0;
  background: var(--bg2);
  box-shadow: none;
  position: relative;
}

.chat-header {
  height: 64px;
  min-height: 64px;
  padding: 10px 26px;
  gap: 12px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}

.chat-header .avatar {
  width: 36px;
  height: 36px;
  border-radius: 11px;
}

.chat-header h2 {
  font-size: 15px;
  letter-spacing: -0.02em;
}

.chat-header small {
  font-size: 11px;
}

.chat-call-action {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--line2);
}

.messages {
  padding: 10px 22px 20px;
  scroll-behavior: auto;
  overflow-anchor: auto;
  scrollbar-gutter: stable;
}

.msg {
  border-radius: 5px;
  padding: 10px 8px 3px;
  gap: 12px;
  margin: 0;
  background: transparent;
}

.msg:hover {
  background: var(--hover-soft);
}

.msg.compact {
  padding-top: 2px;
}

.msg > .avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 11px;
}

.msg-name {
  font-size: 13px;
  letter-spacing: -0.01em;
}

.msg-head {
  gap: 9px;
  margin-bottom: 3px;
}

.msg-body {
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.msg-time {
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.self-pill {
  display: none;
}

.msg-actions {
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.0705882353);
  background: var(--bg2);
}

.msg-actions .msg-action {
  min-height: 30px;
}

.message-date {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  padding: 20px 8px 14px;
}

.message-date::before, .message-date::after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}

.chat-empty {
  font-style: normal;
  border: 0;
  background: transparent;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 75%;
}

.chat-empty h2 {
  font-size: 23px;
  letter-spacing: -0.035em;
  margin: 18px 0 6px;
}

.chat-empty p {
  font-size: 13px;
  max-width: 34ch;
  line-height: 1.6;
}

.chat-empty-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--text2);
  background: var(--bg3);
}

.chat-empty-mark .ui-icon {
  width: 25px;
  height: 25px;
}

.composer {
  border: 1px solid var(--line2);
  border-radius: 9px;
  margin: 6px 26px 20px;
  padding: 0;
  background: var(--bg2);
  box-shadow: none;
  overflow: hidden;
}

.composer:focus-within {
  border-color: var(--accent);
}

.composer textarea, .composer textarea:focus {
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
  padding: 14px 15px 8px;
  min-height: 55px;
}

.composer-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 9px;
  margin: 0;
  border: 0;
}

.composer-action {
  min-height: 32px;
  height: 32px;
  font-size: 12px;
}

.composer .attach-btn {
  border: 0;
  background: transparent;
  color: var(--text2);
  padding: 5px 7px;
}

.composer-hint {
  flex: 1;
  font-size: 10px;
  text-align: right;
  padding-right: 8px;
}

.composer-send {
  padding: 5px 11px;
}

.composer-send:disabled {
  opacity: 0.5;
}

.reply-bar {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg3);
}

.link-embed, .embed {
  border-radius: 8px;
  box-shadow: none;
}

.profile-banner {
  background-image: none;
}

/* Clear section hierarchy without cards inside cards. */
.settings-page {
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: none;
}

.settings-sidebar {
  background: var(--bg);
  padding-block: 17px;
}

.settings-tab {
  min-height: 40px;
  border-radius: 5px;
  margin: 0 8px 3px;
  font-size: 12px;
}

.settings-content-top {
  padding: 22px 28px;
  min-height: 86px;
}

.settings-content-top h1 {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.settings-content-inner {
  padding: 24px 28px 32px;
}

.settings-card {
  border-radius: 8px;
  box-shadow: none;
}

.settings-card-head h2 {
  font-size: 18px;
}

.setting-row {
  padding-block: 17px;
  gap: 16px;
}

.setting-copy small {
  font-size: 12px;
  line-height: 1.55;
}

.settings-action-card, .choice-card, .voice-mode-button {
  border-radius: 7px;
  box-shadow: none;
}

.settings-action-card:hover, .settings-tab:hover {
  transform: none;
}

.forum-card, .forum-thread {
  box-shadow: none;
}

.forum-card:hover, .forum-thread:hover {
  transform: none;
  box-shadow: none;
}

/* The sign-in page uses typography, a wordmark, and plain surfaces. */
.auth-shell {
  background: var(--bg2);
}

.auth-brand-panel {
  background: var(--bg3);
  border-right: 1px solid var(--line);
}

.auth-brand-panel::after {
  display: none;
}

.auth-brand-lockup {
  font-size: 19px;
  letter-spacing: -0.04em;
}

.auth-brand-mark {
  background: var(--text1);
  box-shadow: none;
  border-radius: 8px;
}

.auth-brand-copy h1 {
  max-width: 10ch;
  font-size: clamp(44px, 5vw, 68px);
  font-weight: 620;
  letter-spacing: -0.065em;
  line-height: 1.04;
  margin: 16px 0 22px;
}

.auth-brand-copy > p {
  font-size: 15px;
  line-height: 1.75;
  max-width: 36ch;
}

.auth-capabilities {
  border-top: 1px solid var(--line2);
  border-bottom: 0;
  margin-top: 24px;
}

.auth-capabilities span {
  font-size: 11px;
  color: var(--text2);
}

.auth-form-panel {
  background: var(--bg2);
}

.auth-form-wrap {
  width: min(380px, 100%);
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.auth-heading h2 {
  font-size: 26px;
  letter-spacing: -0.045em;
  font-weight: 650;
}

.auth-heading p {
  font-size: 13px;
  line-height: 1.65;
}

.auth-mode-switch {
  background: var(--bg3);
  border: 1px solid var(--line);
  padding: 3px;
  border-radius: 7px;
}

.auth-mode-btn {
  border-radius: 4px;
  font-size: 12px;
  box-shadow: none;
}

.auth-mode-btn.active {
  background: var(--bg2);
  color: var(--text1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.062745098);
}

.auth-fields {
  gap: 18px;
}

.auth-fields input {
  min-height: 44px;
  border-radius: 6px;
  background: var(--bg2);
}

.auth-fields label {
  font-size: 12px;
  font-weight: 600;
}

.auth-submit {
  min-height: 44px;
  border-radius: 6px;
  margin-top: 4px;
}

.auth-footnote {
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}

.auth-instance-meta {
  margin-top: 22px;
  font-size: 10px;
}

@media (min-width: 761px) and (max-width: 1150px) {
  :root {
    --side-w: 222px;
  }
  .right {
    display: none;
  }
  .content {
    padding: 24px;
  }
  .home-columns {
    grid-template-columns: 1fr;
  }
  .home-welcome {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }
}
@media (max-width: 760px) {
  .layout {
    padding: 0;
    gap: 0;
  }
  .main, .chat-surface {
    border-radius: 0;
    border: 0;
  }
  .content {
    padding: 20px 16px;
  }
  .home-welcome {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    padding-bottom: 22px;
  }
  .home-welcome-copy h1 {
    font-size: 28px;
  }
  .home-welcome-copy p {
    font-size: 13px;
  }
  .home-primary-actions {
    width: 100%;
  }
  .home-stat-grid {
    margin-block: 20px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .home-stat-grid .stat-card {
    min-height: 94px;
    padding: 13px 10px;
  }
  .home-stat-grid .stat-value {
    font-size: 23px;
  }
  .home-stat-grid .stat-label {
    font-size: 10px;
  }
  .home-columns {
    gap: 28px;
  }
  .home-panel .section-head p {
    max-width: 28ch;
  }
  .chat-header {
    height: 60px;
    min-height: 60px;
    padding: 8px 12px;
    gap: 9px;
  }
  .chat-header .avatar {
    width: 32px;
    height: 32px;
  }
  .chat-header h2 {
    font-size: 14px;
  }
  .messages {
    padding: 6px 8px 12px;
  }
  .msg {
    padding-inline: 5px;
    gap: 9px;
  }
  .msg > .avatar {
    width: 30px;
    min-width: 30px;
    height: 30px;
    border-radius: 10px;
  }
  .msg-body {
    font-size: 14px;
  }
  .message-date {
    padding-block: 18px 10px;
    font-size: 10px;
  }
  .composer {
    margin: 4px 10px 10px;
    padding: 0;
    border-radius: 9px;
  }
  .composer textarea {
    font-size: 16px;
    min-height: 49px;
    padding: 12px 12px 5px;
  }
  .composer-footer {
    padding: 3px 6px 6px;
    min-height: 44px;
  }
  .composer-hint {
    display: none;
  }
  .composer-action {
    min-height: 40px;
    height: 40px;
  }
  .composer-send {
    margin-left: auto;
    min-width: 65px;
  }
  .composer .attach-btn {
    min-width: 42px;
  }
  .composer-send .composer-action-label {
    display: inline;
  }
  .chat-empty h2 {
    font-size: 22px;
  }
  .mobile-nav {
    background: var(--bg2);
    border-top: 1px solid var(--line);
    box-shadow: none;
  }
  .mobile-nav-btn.active {
    color: var(--accent);
    background: transparent;
  }
  .mobile-nav-btn.active .mobile-nav-icon-wrap {
    background: var(--active);
    border-radius: 9px;
  }
  .mobile-nav-label {
    font-size: 10px;
  }
  .side.open {
    border-radius: 0 12px 12px 0;
  }
  .settings-page {
    border: 0;
    border-radius: 0;
  }
  .settings-content-top {
    padding: 20px 16px 16px;
  }
  .settings-content-inner {
    padding: 16px 12px 24px;
  }
  .settings-panel {
    padding-inline: 14px;
  }
  .setting-row {
    gap: 12px;
  }
  .auth-shell {
    overflow-y: auto;
  }
  .auth-form-panel {
    padding: 36px 24px;
  }
  .auth-form-wrap {
    width: min(380px, 100%);
  }
  .auth-mobile-brand {
    margin-bottom: 32px;
  }
  .auth-heading h2 {
    font-size: 27px;
  }
  .auth-fields input {
    font-size: 16px;
    min-height: 46px;
  }
  .auth-submit {
    min-height: 46px;
  }
  .auth-mode-btn {
    min-height: 40px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
.mark, .auth-brand-mark {
  position: relative;
  background-image: url("/assets/plainwire-mark.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 78%;
}

.mark::after, .auth-brand-mark::after {
  content: none;
  display: none;
}

.composer textarea {
  resize: none;
}

.auth-error {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger), transparent 94%);
  border-color: color-mix(in srgb, var(--danger), transparent 65%);
}

.toast {
  top: 76px;
  right: 18px;
  bottom: auto;
}

@media (max-width: 760px) {
  .layout {
    padding: 0 0 calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
  }
  [data-mobile-keyboard=open] .layout {
    padding-bottom: 0;
  }
  .composer-action-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
  }
  .composer .attach-btn .composer-action-label {
    display: none;
  }
  .composer-send.composer-action {
    width: auto;
    min-width: 70px !important;
    padding: 0 10px !important;
    border-radius: 6px !important;
  }
  .toast {
    top: calc(68px + env(safe-area-inset-top));
    bottom: auto;
    right: 12px;
    left: 12px;
  }
}
/* Sound previews are labeled actions, with space to compare each cue. */
.notification-sound-preview {
  display: block;
  padding-top: 22px;
}

.notification-sound-preview > div:first-child small {
  display: block;
  margin-top: 5px;
}

.sound-preview-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.sound-preview-btn {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 64px;
  padding: 12px 15px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.sound-preview-btn:hover {
  background: var(--hover-soft);
  border-color: var(--line2);
}

.sound-preview-btn > .ui-icon {
  color: var(--text2);
}

.sound-preview-btn b {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.sound-preview-btn small {
  display: block;
  margin-top: 4px;
  color: var(--text2);
  font-size: 12px;
}

.sound-preview-action {
  margin-left: auto;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 5px;
  background: var(--active);
}

/* Lucide icons, ISC licensed. Local assets, no runtime dependency. */
.ui-icon, .call-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  min-width: 18px;
  flex-shrink: 0;
  position: relative;
  border: 0;
  border-radius: 0;
  background: currentColor;
  mask: var(--icon) center/contain no-repeat;
  -webkit-mask: var(--icon) center/contain no-repeat;
  transform: none;
}

.ui-icon::before, .ui-icon::after, .call-icon::before, .call-icon::after {
  display: none;
}

.ui-icon-home {
  --icon: url('/assets/icons/House.svg');
}

.ui-icon-forums {
  --icon: url('/assets/icons/MessagesSquare.svg');
}

.ui-icon-messages {
  --icon: url('/assets/icons/MessageSquare.svg');
}

.ui-icon-friends {
  --icon: url('/assets/icons/Users.svg');
}

.ui-icon-servers {
  --icon: url('/assets/icons/PanelsTopLeft.svg');
}

.ui-icon-settings {
  --icon: url('/assets/icons/Settings.svg');
}

.ui-icon-profile {
  --icon: url('/assets/icons/UserRound.svg');
}

.ui-icon-notifications {
  --icon: url('/assets/icons/Bell.svg');
}

.ui-icon-menu {
  --icon: url('/assets/icons/Menu.svg');
}

.ui-icon-search {
  --icon: url('/assets/icons/Search.svg');
}

.ui-icon-attach {
  --icon: url('/assets/icons/Paperclip.svg');
}

.ui-icon-send {
  --icon: url('/assets/icons/ArrowUp.svg');
}

.ui-icon-call {
  --icon: url('/assets/icons/Phone.svg');
}

.ui-icon-call-end {
  --icon: url('/assets/icons/PhoneOff.svg');
}

.call-icon-mic {
  --icon: url('/assets/icons/Mic.svg');
}

.call-icon-audio {
  --icon: url('/assets/icons/Headphones.svg');
}

.call-icon-screen {
  --icon: url('/assets/icons/MonitorUp.svg');
}

.call-icon-close {
  --icon: url('/assets/icons/X.svg');
}

.call-icon-mic.call-icon-off {
  --icon: url('/assets/icons/MicOff.svg');
}

.call-icon-audio.call-icon-off {
  --icon: url('/assets/icons/HeadphoneOff.svg');
}

.call-icon-hangup {
  --icon: url('/assets/icons/PhoneOff.svg');
}

/* Rich text belongs to the conversation, with restrained syntax colours. */
pw-markdown {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

pw-markdown:not(:defined)::before {
  content: attr(source);
  white-space: pre-wrap;
}

pw-markdown > :first-child {
  margin-top: 0;
}

pw-markdown > :last-child {
  margin-bottom: 0;
}

pw-markdown p {
  margin: 0.45em 0;
}

pw-markdown h1, pw-markdown h2, pw-markdown h3, pw-markdown h4 {
  line-height: 1.3;
  margin: 0.85em 0 0.4em;
  color: var(--text);
}

pw-markdown h1 {
  font-size: 1.35em;
}

pw-markdown h2 {
  font-size: 1.2em;
}

pw-markdown h3, pw-markdown h4 {
  font-size: 1.08em;
}

pw-markdown ul, pw-markdown ol {
  padding-left: 1.6em;
  margin: 0.5em 0;
}

pw-markdown li + li {
  margin-top: 0.2em;
}

pw-markdown blockquote {
  border-left: 3px solid var(--line);
  padding: 0.1em 0 0.1em 14px;
  margin: 0.7em 0;
  color: var(--text2);
}

pw-markdown hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1em 0;
}

pw-markdown code {
  font: 0.9em/1.6 ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

pw-markdown :not(pre) > code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--bg3);
  border: 1px solid var(--line);
}

.code-block {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  margin: 10px 0;
  background: var(--bg2);
  max-width: 100%;
}

.code-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px 5px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 11px/1.5 ui-monospace, monospace;
  background: var(--bg3);
}

.code-copy {
  color: var(--text2);
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 9px;
  border-radius: 4px;
  cursor: pointer;
  font: 11px/1.5 inherit;
}

.code-copy:hover {
  background: var(--hover);
  border-color: var(--line);
}

.code-block pre {
  margin: 0;
  padding: 14px 16px;
  max-height: 400px;
  overflow: auto;
  overscroll-behavior: contain;
  white-space: pre;
  tab-size: 4;
  scrollbar-width: thin;
}

.code-block code {
  display: block;
  color: var(--text);
  overflow-wrap: normal;
}

.markdown-table {
  max-width: 100%;
  overflow: auto;
  margin: 10px 0;
  overscroll-behavior: contain;
}

.markdown-table table {
  border-collapse: collapse;
  font-size: 0.95em;
}

.markdown-table th, .markdown-table td {
  border: 1px solid var(--line);
  padding: 7px 12px;
}

.markdown-table th {
  background: var(--bg3);
  text-align: left;
}

.hljs-comment, .hljs-quote {
  color: var(--muted);
  font-style: italic;
}

.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-deletion {
  color: #ab4060;
}

.hljs-string, .hljs-regexp, .hljs-addition, .hljs-template-tag {
  color: #267046;
}

.hljs-title, .hljs-section, .hljs-name, .hljs-attribute {
  color: #315f9a;
}

.hljs-number, .hljs-symbol, .hljs-built_in, .hljs-type, .hljs-params {
  color: #916117;
}

.hljs-meta, .hljs-variable {
  color: #795697;
}

html[data-theme=dark] .hljs-keyword, html[data-theme=dark] .hljs-selector-tag, html[data-theme=dark] .hljs-literal, html[data-theme=dark] .hljs-deletion {
  color: #e694aa;
}
html[data-theme=dark] .hljs-string, html[data-theme=dark] .hljs-regexp, html[data-theme=dark] .hljs-addition {
  color: #9bcba1;
}
html[data-theme=dark] .hljs-title, html[data-theme=dark] .hljs-section, html[data-theme=dark] .hljs-name, html[data-theme=dark] .hljs-attribute {
  color: #94b8e8;
}
html[data-theme=dark] .hljs-number, html[data-theme=dark] .hljs-symbol, html[data-theme=dark] .hljs-built_in, html[data-theme=dark] .hljs-type, html[data-theme=dark] .hljs-params {
  color: #d9bc84;
}
html[data-theme=dark] .hljs-meta, html[data-theme=dark] .hljs-variable {
  color: #c6a6d9;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme=light]) .hljs-keyword, html:not([data-theme=light]) .hljs-literal, html:not([data-theme=light]) .hljs-deletion {
    color: #e694aa;
  }
  html:not([data-theme=light]) .hljs-string, html:not([data-theme=light]) .hljs-regexp, html:not([data-theme=light]) .hljs-addition {
    color: #9bcba1;
  }
  html:not([data-theme=light]) .hljs-title, html:not([data-theme=light]) .hljs-section, html:not([data-theme=light]) .hljs-name, html:not([data-theme=light]) .hljs-attribute {
    color: #94b8e8;
  }
  html:not([data-theme=light]) .hljs-number, html:not([data-theme=light]) .hljs-symbol, html:not([data-theme=light]) .hljs-built_in, html:not([data-theme=light]) .hljs-type, html:not([data-theme=light]) .hljs-params {
    color: #d9bc84;
  }
  html:not([data-theme=light]) .hljs-meta, html:not([data-theme=light]) .hljs-variable {
    color: #c6a6d9;
  }
}
.msg-body, .reply-body, .thread-post-body {
  min-width: 0;
}

.composer textarea {
  field-sizing: fixed;
  overscroll-behavior: contain;
  max-height: 180px;
  padding: 14px 16px;
  line-height: 1.55;
  scrollbar-gutter: stable;
}

/* The toggle stays in place. Only the bounded panel floats above chat. */
.composer {
  position: relative;
  overflow: visible;
  border-radius: 12px;
  background: var(--bg2);
}

.composer textarea {
  border-radius: 12px 12px 0 0;
  min-height: 64px;
}

.composer-footer {
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  background: var(--bg2);
  border-radius: 0 0 12px 12px;
}

.composer-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.compose-format-help {
  font-size: 12px;
  color: var(--text2);
}

.compose-format-help summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 7px 9px;
  list-style: none;
  border-radius: 6px;
  min-height: 34px;
}

.compose-format-help summary::-webkit-details-marker {
  display: none;
}

.compose-format-help summary:hover, .compose-format-help[open] summary {
  background: var(--active);
  color: var(--text);
}

.format-symbol {
  font-size: 14px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.compose-format-panel {
  position: fixed;
  z-index: 150;
  width: min(440px, 100vw - 24px);
  max-height: min(360px, 65dvh);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: 12px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.1450980392);
  padding: 0 16px 12px;
  color: var(--text);
}

.format-panel-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg2);
  padding: 10px 0;
  z-index: 1;
  border-bottom: 1px solid var(--line);
}

.format-close {
  border: 0;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 23px;
  width: 36px;
  height: 36px;
  border-radius: 6px;
}

.format-close:hover {
  background: var(--hover);
}

.format-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.format-tools button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg3);
  color: var(--text);
  padding: 7px 10px;
  min-height: 36px;
  cursor: pointer;
  font: inherit;
}

.format-tools button:hover {
  background: var(--active);
  border-color: var(--line2);
}

.format-tools [data-format=bold] {
  font-weight: 700;
}

.format-tools [data-format=italic] {
  font-style: italic;
}

.format-tools [data-format=code], .format-tools [data-format=block] {
  font-family: ui-monospace, monospace;
}

.format-tip {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  margin: 12px 0;
}

.compose-preview {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.compose-preview > small {
  display: block;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.compose-preview pw-markdown {
  font-size: 13px;
}

.channel-glyph {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--bg3);
  color: var(--muted);
}

.channel-glyph::after {
  content: none;
}

.channel-glyph.text::before {
  content: "#";
  font: 500 22px/1 ui-monospace, monospace;
}

.channel-glyph.voice::before {
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  mask: url("/assets/icons/Headphones.svg") center/contain no-repeat;
  -webkit-mask: url("/assets/icons/Headphones.svg") center/contain no-repeat;
}

.channel-link {
  border-radius: 8px;
  gap: 12px;
  padding: 10px 12px;
  transition: background-color 0.12s;
}

.channel-link:hover {
  background: var(--hover);
}

.channel-link:hover .channel-glyph {
  color: var(--accent);
}

.channel-group-title {
  font-size: 10px;
  letter-spacing: 0.09em;
  margin-top: 20px;
}

.watch-screen {
  white-space: nowrap;
  font-size: 11px;
  min-height: 34px;
  padding: 6px 10px;
}

.call-user-info {
  min-width: 0;
}

.call-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pw-float {
  border: 1px solid var(--line);
  border-radius: 10px;
}

.pw-float-bar {
  min-height: 44px;
}

.pw-float-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-manager {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 18px;
}

.invite-manager h3 {
  font-size: 14px;
  margin: 0 0 10px;
}

.invite-link-list {
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 12px;
}

.invite-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.invite-link-info {
  flex: 1;
  min-width: 0;
}

.invite-link-info small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.5;
}

.danger-text {
  color: var(--danger);
}

.server-customize-preview {
  border: 1px solid var(--line);
  border-left: 3px solid var(--server-accent, var(--accent));
  padding: 16px 18px;
  border-radius: 6px;
  margin: 18px 0;
  background: var(--bg);
}

.server-customize-preview h3 {
  margin: 5px 0 10px;
}

.server-welcome {
  padding: 24px;
}

.server-welcome h2 {
  font-size: 16px;
  margin: 0 0 12px;
}

.settings-sidebar {
  min-width: 185px;
}

.settings-content-inner {
  padding: 28px 32px 40px;
}

.settings-card-head {
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.settings-card-head p {
  max-width: 55ch;
  line-height: 1.55;
}

.settings-panel {
  padding-inline: 24px;
}

.setting-row {
  min-height: 78px;
  padding-block: 18px;
}

.settings-search {
  padding: 16px 28px 0;
}

.settings-search input {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
}

.settings-search-results {
  display: grid;
  gap: 4px;
  padding: 8px 0;
}

.settings-search-results button {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  border-radius: 5px;
  cursor: pointer;
}

.settings-search-results small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.settings-search-results button:hover {
  background: var(--hover);
}

@media (max-width: 760px) {
  .messages {
    padding-inline: 16px;
  }
  .msg {
    padding-block: 9px;
  }
  .msg-body {
    line-height: 1.6;
  }
  .composer textarea {
    padding: 14px 14px 8px;
    max-height: 176px;
  }
  .composer-footer {
    padding: 6px 9px 9px;
    gap: 4px;
  }
  .compose-format-help summary {
    padding: 10px 7px;
    min-height: 40px;
    display: flex;
    align-items: center;
  }
  .code-heading {
    padding: 4px 6px 4px 12px;
  }
  .code-copy {
    min-height: 40px;
    min-width: 48px;
  }
  .code-block pre {
    padding: 13px;
    max-height: 300px;
    font-size: 12px;
  }
  .modal-card .modal-body {
    padding: 20px;
  }
  .field + .field {
    margin-top: 18px;
  }
  .settings-content-top {
    padding: 22px 20px 18px;
  }
  .settings-content-inner {
    padding: 20px 16px 28px;
  }
  .settings-card-head {
    padding: 20px;
  }
  .settings-panel {
    padding-inline: 20px;
  }
  .settings-search {
    padding: 16px 20px 0;
  }
  .settings-mobile-nav {
    padding: 10px 12px;
    gap: 6px;
    scroll-padding-inline: 12px;
  }
  .settings-mobile-tab {
    padding-inline: 14px;
    min-height: 44px;
  }
  .setting-row {
    gap: 14px;
  }
  .invite-link-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .invite-link-info {
    flex-basis: 100%;
  }
  .invite-link-row .btn {
    min-height: 42px;
  }
  .watch-screen {
    min-height: 44px;
  }
  .server-welcome {
    padding: 20px;
  }
  .pw-float-bar {
    min-height: 48px;
    padding-inline: 12px;
  }
}
.pw-float {
  flex-direction: column;
}

.pw-float-bar {
  flex: 0 0 auto;
}

.pw-float video {
  flex: 1 1 auto;
  min-height: 0;
  height: 0;
  object-fit: contain;
  pointer-events: auto;
}

.settings-search input {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg2);
  color: var(--text);
}

.settings-search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.settings-tab {
  background: transparent;
}

.settings-tab.active {
  background: var(--active);
  color: var(--text);
  font-weight: 650;
}

@media (max-width: 760px) {
  .pw-float {
    top: max(76px, env(safe-area-inset-top)) !important;
    bottom: auto !important;
    height: min(30dvh, 240px) !important;
    min-height: 160px;
  }
}
pw-input-volume, pw-user-volume {
  display: block;
  min-width: 0;
}

pw-input-volume label, pw-user-volume label {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 12px;
  color: var(--text2);
  font-size: 11px;
}

pw-input-volume input, pw-user-volume input {
  grid-column: 1/-1;
  width: 100%;
  min-height: 28px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  padding: 0;
  border: 0;
  background: transparent;
}

pw-input-volume output, pw-user-volume output {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.call-user-row {
  flex-wrap: wrap;
}

.call-user-row pw-user-volume {
  flex: 1 0 100%;
  padding: 6px 0 0 44px;
}

.call-input-panel pw-input-volume {
  margin-top: 10px;
}

@media (max-width: 760px) {
  pw-input-volume input, pw-user-volume input {
    min-height: 38px;
  }
}
.voice-participant {
  flex-wrap: wrap;
}

.voice-participant pw-user-volume, .voice-participant pw-input-volume {
  flex: 1 0 100%;
  padding-left: 44px;
}

/* Transient feedback must remain dismissible while call details are open. */
.toast {
  z-index: 1200;
}

/* Lucide's headphone silhouette is optically bottom-heavy in square controls.
   A one-pixel optical correction keeps it centered beside mic/screen icons. */
.call-control .call-icon-audio,
.call-bar-controls .call-icon-audio,
.call-overlay-controls .call-icon-audio,
.dm-call-bar-controls .call-icon-audio,
.icon-btn .call-icon-audio {
  transform: translateY(-1px);
}

/* The call workspace: quiet surfaces, generous controls, useful screen space. */
.call-layer {
  width: max-content;
  max-width: calc(100vw - 24px);
  align-items: flex-end;
}

.call-overlay.expanded {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 420px;
  height: min(710px, 100dvh - 40px);
  min-width: 340px;
  min-height: 360px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  container-type: inline-size;
  border-radius: 16px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--line2);
  scrollbar-width: thin;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.1411764706);
}

.call-overlay.expanded > * {
  flex-shrink: 0;
}

.call-overlay-header {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 80px;
  padding: 18px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}

.call-overlay-title {
  font-size: 19px;
  letter-spacing: -0.025em;
  font-weight: 650;
}

.call-overlay-meta {
  gap: 7px;
  font-size: 11px;
}

.call-minimize {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.call-overlay-users {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 14px;
  max-height: none;
  overflow: visible;
  flex: 1 0 auto;
}

.call-user-row {
  min-height: 100px;
  margin: 0;
  padding: 14px;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg2);
  align-content: center;
}

.call-user-row > .avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
}

.call-user-row .avatar.live {
  outline: 2px solid color-mix(in srgb, var(--ok), transparent 45%);
  outline-offset: 3px;
}

.call-user-name {
  font-size: 14px;
}

.call-user-status {
  font-size: 11px;
}

.call-user-row pw-user-volume {
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
}

pw-user-volume input[type=range], pw-input-volume input[type=range] {
  appearance: none;
  background: transparent;
  height: 24px;
  cursor: pointer;
}
pw-user-volume input[type=range]::-webkit-slider-runnable-track, pw-input-volume input[type=range]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: var(--line2);
}
pw-user-volume input[type=range]::-webkit-slider-thumb, pw-input-volume input[type=range]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
pw-user-volume input[type=range]::-moz-range-track, pw-input-volume input[type=range]::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: var(--line2);
}
pw-user-volume input[type=range]::-moz-range-thumb, pw-input-volume input[type=range]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
pw-user-volume input[type=range]:focus-visible, pw-input-volume input[type=range]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 5px;
}

.call-input-panel {
  margin: 0 14px 12px;
  padding: 14px;
  border-radius: 10px;
  background: var(--bg2);
}

.call-input-panel select {
  height: 38px;
}

.call-mic-meter {
  margin-top: 10px;
  height: 5px;
}

.call-health {
  margin: 0 14px 10px;
  border-radius: 10px;
  background: var(--bg2);
}

.call-health summary {
  min-height: 42px;
  padding: 12px 14px;
}

.call-tools {
  padding: 0 14px 10px;
}

.call-overlay-controls {
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: var(--bg2);
  padding: 12px 16px 18px;
  border-top: 1px solid var(--line2);
}

.call-control {
  min-height: 58px;
  border-radius: 10px;
  background: var(--bg);
  border-color: var(--line);
  transition: background-color 0.12s;
}

.call-control:hover {
  background: var(--hover);
}

.call-control.leave {
  background: #a82f40;
  border-color: #a82f40;
}

.call-control.active {
  border-color: var(--accent);
  background: var(--active);
}

.call-resize-handle {
  position: sticky;
  bottom: 0;
  z-index: 4;
  align-self: flex-end;
  width: 26px;
  height: 18px;
  min-height: 18px;
  margin-top: -18px;
  padding: 0 3px 1px 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: nwse-resize;
  touch-action: none;
  font: 16px/1 monospace;
}

.call-resize-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.call-sharing-row {
  margin: 12px 14px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--active);
  color: var(--text);
}

pw-screen-settings {
  display: block;
  margin: 0 14px 10px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  font-size: 12px;
}

pw-screen-settings summary {
  padding: 12px 14px;
  min-height: 42px;
  cursor: pointer;
  font-weight: 600;
}

pw-screen-settings label {
  display: block;
  margin: 0 14px 10px;
  color: var(--text2);
}

pw-screen-settings select {
  display: block;
  width: 100%;
  padding: 9px;
  margin-top: 6px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

pw-screen-settings p {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  margin: 10px 14px;
}

pw-screen-settings button {
  margin: 0 14px 14px;
}

pw-screen-settings .screen-audio-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
}
pw-screen-settings .screen-audio-option input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}
pw-screen-settings .screen-audio-option b,
pw-screen-settings .screen-audio-option small {
  display: block;
}
pw-screen-settings .screen-audio-option b {
  color: var(--text1);
  font-size: 11px;
}
pw-screen-settings .screen-audio-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
pw-screen-settings .screen-audio-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: 9px 11px;
}
pw-screen-settings .screen-audio-status.active {
  border-color: color-mix(in srgb, var(--ok), transparent 55%);
  background: color-mix(in srgb, var(--ok), transparent 92%);
  color: var(--ok);
}
pw-screen-settings .screen-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 14px 14px;
}
pw-screen-settings .screen-settings-actions button {
  margin: 0;
}

@container (min-width: 560px) {
  .call-overlay-users {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .call-user-row {
    min-height: 126px;
  }
  .call-control {
    flex-direction: row;
    gap: 10px;
    font-size: 12px;
  }
  .call-input-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;
  }
  .call-input-heading, .call-mic-meter {
    grid-column: 1/-1;
  }
  .call-input-panel pw-input-volume {
    grid-column: 2;
    grid-row: 2/4;
    margin: 0;
  }
}
.pw-float {
  background: #111418;
  border: 1px solid #424950;
  border-radius: 14px;
  min-width: 300px;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.2509803922);
  color-scheme: dark;
}

.pw-float-bar {
  min-height: 56px;
  padding: 10px 12px 10px 18px;
  background: #20252b;
  border-bottom: 1px solid #343b43;
  gap: 12px;
}

.pw-float-title {
  font-size: 13px;
  font-weight: 600;
  color: #eef2f6;
}

.pw-float-title-wrap {
  gap: 4px;
}

.pw-float-state {
  font-size: 10px;
  color: #b1bac4;
}

.pw-float-state-dot {
  width: 5px;
  height: 5px;
  background: #79b996;
}

.pw-float-controls {
  gap: 4px;
}

.pw-float-btn {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #c2c9d1;
}

.pw-float-btn:hover {
  background: #333b44;
  border-color: #485360;
}

.pw-float-window-icon.pip {
  width: 16px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.pw-float-window-icon.pip::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 7px;
  height: 4px;
  background: currentColor;
}

.pw-float-window-icon.hide::before {
  content: "";
  position: absolute;
  inset: 6px 1px auto;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
}

.pw-float video {
  background: #111418;
  display: block;
  width: 100%;
}

.screen-viewer-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 38px;
  padding: 5px 14px;
  border-top: 1px solid #343b43;
  background: #20252b;
  color: #b1bac4;
  font: 10px/1.4 ui-monospace, monospace;
}

.screen-viewer-footer button {
  margin-left: auto;
  min-height: 28px;
  padding: 4px 9px;
  white-space: nowrap;
  border: 1px solid #424950;
  border-radius: 5px;
  background: transparent;
  color: #eef2f6;
  font: 11px/1.4 system-ui;
  cursor: pointer;
}

.screen-play-retry {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 18px;
  color: #fff;
  background: #2e3741;
  border: 1px solid #596676;
  border-radius: 8px;
  cursor: pointer;
}

.screen-play-retry[hidden] {
  display: none;
}

.pw-float:fullscreen {
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0;
  resize: none;
}

@supports (dynamic-range-limit: no-limit) {
  .pw-float video {
    dynamic-range-limit: no-limit;
  }
}
/* More readable everyday chat, with consistent spacing between surfaces. */
.chat-header {
  min-height: 68px;
  padding-inline: 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}

.messages {
  scroll-padding-bottom: 20px;
}

.msg {
  padding-block: 9px;
}

.msg-head {
  margin-bottom: 4px;
}

.msg-body {
  line-height: 1.65;
}

.composer {
  margin-bottom: 18px;
}

.channel-link {
  min-height: 50px;
}

.server-welcome {
  border-radius: 12px;
  border-color: var(--line);
}

@media (prefers-reduced-motion: reduce) {
  .call-control {
    transition: none;
  }
}
@media (max-width: 760px) {
  .call-layer {
    width: auto;
    max-width: none;
  }
  .call-overlay.expanded {
    min-width: 0;
    width: 100%;
    height: auto;
    max-height: calc(var(--pw-visual-height, 100dvh) - var(--mobile-nav-h) - env(safe-area-inset-bottom) - 26px);
    min-height: 0;
    border-radius: 16px;
  }
  .call-overlay-header {
    min-height: 66px;
    padding: 12px 16px;
  }
  .call-overlay-title {
    font-size: 17px;
  }
  .call-overlay-users {
    padding: 10px;
    gap: 7px;
  }
  .call-user-row {
    min-height: 78px;
    padding: 10px 12px;
  }
  .call-user-row pw-user-volume {
    padding-top: 5px;
  }
  .call-input-panel {
    padding: 12px;
    margin-inline: 10px;
  }
  .call-overlay-controls {
    padding: 10px 12px;
    gap: 7px;
  }
  .call-control {
    min-height: 54px;
  }
  .call-resize-handle {
    display: none;
  }
  .pw-float {
    top: max(72px, env(safe-area-inset-top)) !important;
    min-width: 0;
    height: min(34dvh, 280px) !important;
    min-height: 180px;
    border-radius: 12px;
  }
  .pw-float.expanded-view {
    height: calc(var(--pw-visual-height, 100dvh) - 150px) !important;
    max-height: calc(var(--pw-visual-height, 100dvh) - 150px) !important;
  }
  .pw-float-bar {
    min-height: 48px;
    padding: 6px 8px 6px 12px;
    gap: 6px;
  }
  .pw-float-controls {
    gap: 1px;
  }
  .pw-float-btn {
    width: 34px;
    height: 36px;
  }
  .screen-viewer-footer {
    padding-inline: 10px;
    gap: 8px;
    font-size: 9px;
  }
  .chat-header {
    min-height: 62px;
    padding-inline: 14px;
  }
  .msg {
    padding-block: 10px;
  }
  .composer {
    margin-bottom: 10px;
  }
}
@media (max-height: 560px) and (min-width: 761px) {
  .call-overlay.expanded {
    min-height: 280px;
  }
}
.pw-float.screen-visual-hidden {
  height: auto !important;
  min-height: 0;
  resize: none;
}
.pw-float.screen-visual-hidden::after,
.pw-float.screen-visual-hidden > video,
.pw-float.screen-visual-hidden > .screen-viewer-footer,
.pw-float.screen-visual-hidden > .screen-play-retry {
  display: none;
}
.pw-float.screen-visual-hidden .pw-float-bar {
  border-bottom: 0;
}
.pw-float.screen-visual-hidden .pw-float-state span:last-child::after {
  content: " · video hidden";
}

/* Everyday workspace. Shared surfaces and type rules, then route-specific layout. */
:root, [data-theme=light] {
  --bg: #f3f4f6;
  --bg2: #ffffff;
  --bg3: #ebedf0;
  --bg4: #e1e4e9;
  --text: #303641;
  --text1: #1d222b;
  --text2: #596272;
  --muted: #646e7d;
  --line: #e0e3e8;
  --line2: #c5cbd5;
  --hover: #e7eaf0;
  --hover-soft: #f4f5f8;
  --active: #e2e8f2;
  --accent: #43638e;
  --accent2: #354f74;
  --action: var(--accent);
  --on-action: #ffffff;
  --navigation-width: 264px;
}

[data-theme=dark] {
  --bg: #1b1d22;
  --bg2: #22252b;
  --bg3: #17191e;
  --bg4: #121418;
  --text: #d8dce4;
  --text1: #f1f3f7;
  --text2: #afb7c5;
  --muted: #9ba5b5;
  --line: #333740;
  --line2: #4b5361;
  --hover: #303540;
  --hover-soft: #292d35;
  --active: #333e52;
  --accent: #a9bfdf;
  --accent2: #c5d4eb;
  --action: color-mix(in srgb, var(--accent), white 50%);
  --on-action: #182132;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]):not([data-theme=dark]) {
    --bg: #1b1d22;
    --bg2: #22252b;
    --bg3: #17191e;
    --bg4: #121418;
    --text: #d8dce4;
    --text1: #f1f3f7;
    --text2: #afb7c5;
    --muted: #9ba5b5;
    --line: #333740;
    --line2: #4b5361;
    --hover: #303540;
    --hover-soft: #292d35;
    --active: #333e52;
    --accent: #a9bfdf;
    --accent2: #c5d4eb;
    --action: color-mix(in srgb, var(--accent), white 50%);
    --on-action: #182132;
  }
}
html, body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -0.008em;
}

button, input, textarea, select {
  letter-spacing: inherit;
}

.btn {
  background: var(--action);
  color: var(--on-action);
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 600;
}

.btn:hover {
  filter: none;
  background: var(--action);
  color: var(--on-action);
}

.btn.secondary, label.btn.secondary {
  background: var(--bg2);
  border: 1px solid var(--line2);
  color: var(--text);
}

.btn.ghost, .btn.icon-btn {
  background: transparent;
  color: var(--text2);
}

.btn.secondary:hover, .btn.ghost:hover, .btn.icon-btn:hover {
  background: var(--hover);
  color: var(--text1);
}

.btn.call-decline, .btn.danger {
  background: #ae3546;
  color: #fff;
  border-color: transparent;
}

.btn:disabled {
  opacity: 0.5;
}

.btn:focus-visible, .row:focus-visible {
  outline-offset: 2px;
}

.badge {
  min-width: 17px;
  height: 17px;
  font-size: 10px;
  background: var(--action);
  color: var(--on-action);
  box-shadow: none;
}

.field label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.field input, .field select, .field textarea {
  background: var(--bg2);
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 14px;
}

.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
}

/* Native scrolling, with a usable thumb and no wheel interception. */
:where(.content, .side .list, .settings-content, .messages, .modal-card, .modal-body, .call-overlay, .people-options, .composer textarea, .settings-mobile-nav, .code-block pre) {
  scrollbar-width: auto;
  scrollbar-color: var(--line2) transparent;
  overscroll-behavior: contain;
}
:where(.content, .side .list, .settings-content, .messages, .modal-card, .modal-body, .call-overlay, .people-options, .composer textarea, .settings-mobile-nav, .code-block pre)::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
:where(.content, .side .list, .settings-content, .messages, .modal-card, .modal-body, .call-overlay, .people-options, .composer textarea, .settings-mobile-nav, .code-block pre)::-webkit-scrollbar-thumb {
  background: var(--line2);
  border: 3px solid transparent;
  border-radius: 8px;
  background-clip: padding-box;
}
:where(.content, .side .list, .settings-content, .messages, .modal-card, .modal-body, .call-overlay, .people-options, .composer textarea, .settings-mobile-nav, .code-block pre)::-webkit-scrollbar-thumb:hover {
  background-color: var(--muted);
}
:where(.content, .side .list, .settings-content, .messages, .modal-card, .modal-body, .call-overlay, .people-options, .composer textarea, .settings-mobile-nav, .code-block pre)::-webkit-scrollbar-track {
  background: transparent;
}

.messages, .settings-content, .side .list, .people-options {
  scrollbar-gutter: stable;
}

/* Navigation has one clear active state; unread rows use weight and a badge. */
.side {
  position: relative;
}

.side-head {
  padding: 24px 22px 18px;
}

.side-head h1 {
  font-size: 17px;
  font-weight: 650;
}

.side-title-copy small {
  font-size: 11px;
  margin-top: 4px;
  color: var(--muted);
}

.side .search {
  padding: 12px;
  display: grid;
  gap: 8px;
}

#globalSearch {
  width: 100%;
  height: 32px;
  padding: 6px 10px;
  background: transparent;
  border-color: transparent;
  font-size: 12px;
  color: var(--text);
}

#globalSearch:focus {
  background: var(--bg2);
  border-color: var(--line2);
}

.quick-jump-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  text-align: left;
  border: 1px solid var(--line2);
  border-radius: 7px;
  color: var(--text2);
  background: var(--bg2);
  cursor: pointer;
  font-size: 12px;
}

.quick-jump-button .ui-icon {
  width: 15px;
  height: 15px;
}

.quick-jump-button kbd {
  margin-left: auto;
  font: 10px/1.5 inherit;
  color: var(--muted);
  white-space: nowrap;
}

.workspace-menu {
  margin-top: 12px;
  position: relative;
  font-size: 12px;
}

.workspace-menu > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  cursor: pointer;
  color: var(--text2);
  list-style: none;
}

.workspace-menu > summary::-webkit-details-marker {
  display: none;
}

.workspace-menu-items {
  position: absolute;
  top: 100%;
  left: -5px;
  right: -5px;
  z-index: 40;
  padding: 6px;
  border: 1px solid var(--line2);
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1333333333);
  background: var(--bg2);
  display: grid;
  gap: 4px;
}

.workspace-menu-items .btn {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
}

.side .list {
  padding: 0 10px 18px;
}

.side .list > .row:not(.dm-row) {
  min-height: 38px;
  padding: 8px;
  color: var(--text2);
}

.side .list > .row:not(.dm-row) b {
  font-size: 13px;
  font-weight: 500;
}

.side .list > .row:not(.dm-row) .grow > small {
  display: none;
}

.side .nav-symbol {
  width: 24px;
  height: 24px;
  border-radius: 0;
  background: none;
}

.side .dm-row {
  margin-block: 2px;
  min-height: 62px;
  padding: 11px 9px;
  box-shadow: none;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
}

.side .dm-row.unread {
  background: transparent;
}

.side .dm-row:hover {
  background: var(--hover);
  text-decoration: none;
}

.side .dm-row.active {
  background: var(--active);
  box-shadow: none;
}

.side .dm-row .avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.dm-preview {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 3px;
}

.dm-name {
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
}

.dm-row.unread .dm-name {
  color: var(--text1);
  font-weight: 650;
}

.side .side-section-heading {
  padding: 24px 8px 8px;
}

.side .side-section-heading small {
  display: none;
}

.side .side-section-heading b, .channel-group-title {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.075em;
  font-weight: 650;
}

.side .side-section-heading .btn {
  min-height: 26px;
  padding: 3px 8px;
  font-size: 10px;
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--line2);
}

.user-panel {
  background: var(--bg3);
  padding: 12px;
  min-height: 68px;
  border-top: 1px solid var(--line);
}

.side-title-row {
  min-width: 0;
  gap: 12px;
}

.server-side-identity {
  flex: 1;
  min-width: 0;
  gap: 12px;
  align-items: center;
}

.server-side-identity .server-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 11px;
  border: 1px solid var(--line2);
  background: var(--bg2);
}

.server-side-head h1 {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
  margin: 0;
}

.server-side-head .side-title-copy small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}

.server-side-head .nav-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 18px;
}

.server-side-head .nav-actions .btn {
  min-width: 0;
  font-size: 11px;
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 7px;
}

.side .search {
  padding-inline: 20px;
}

.side .server-channel-list {
  padding: 0 16px 20px;
}

.channel-group-title {
  margin-top: 22px;
  padding-inline: 10px;
}

.channel-link {
  border-radius: 7px;
}

.rail .mark {
  appearance: none;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0 0 14px;
  border: 1px solid var(--line2);
  border-radius: 11px;
  color: var(--text1);
  background: var(--bg2);
  font: 750 21px/1 Inter, system-ui, sans-serif;
  cursor: pointer;
}

.rail .mark::after {
  content: none;
}

.rail .mark:hover {
  background: var(--hover);
  border-color: var(--muted);
}

.rail .mark:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.channel-link {
  min-height: 40px;
  padding: 8px 9px;
  gap: 9px;
}

.channel-glyph {
  width: 24px;
  height: 24px;
  flex-basis: 24px;
  background: transparent;
}

.channel-name {
  font-size: 13px;
}

pw-sidebar-resize {
  display: contents;
}

.sidebar-resize {
  position: absolute;
  z-index: 5;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
}

.sidebar-resize:hover, .sidebar-resize:focus-visible {
  background: var(--accent);
  outline: 0;
  opacity: 0.5;
}

@media (min-width: 761px) {
  .rail {
    width: 60px;
    background: var(--bg3);
    gap: 9px;
    padding-top: 18px;
    border: 0;
  }
  .rail .mark {
    width: 40px;
    height: 40px;
  }
  .rail-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }
  .side {
    width: var(--navigation-width);
    flex: 0 0 var(--navigation-width);
  }
  .main {
    margin: 8px 8px 8px 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg2);
  }
  .layout {
    background: var(--bg);
  }
  .topbar {
    height: 62px;
    min-height: 62px;
    padding-inline: 30px;
  }
  .main .content {
    background: var(--bg2);
    padding: 28px 32px;
  }
  .route-chat .content {
    padding: 0;
  }
  .route-settings .content {
    padding: 0;
  }
}
/* Reading and writing share the same alignment and line length. */
.chat-surface {
  background: var(--bg2);
}

.chat-header {
  padding-inline: 28px;
  height: 70px;
  background: var(--bg2);
}

.chat-header h2 {
  font-size: 16px;
  font-weight: 650;
}

.messages {
  padding: 18px 24px 24px;
  background: var(--bg2);
}

.msg {
  padding: 12px 8px;
  gap: 13px;
  contain: layout style;
}

.msg .avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 11px;
}

.msg.compact {
  padding-block: 4px;
}

.msg-body {
  font-size: calc(14px * var(--ui-font-scale));
  line-height: 1.65;
  max-width: 88ch;
}

.msg-name {
  font-size: 13px;
  font-weight: 650;
  color: var(--text1);
}

.msg-head {
  margin-bottom: 5px;
  gap: 9px;
}

.msg-time {
  font-size: 10px;
  color: var(--muted);
}

.message-date {
  margin: 24px 0 20px;
  color: var(--muted);
  font-size: 11px;
}

.message-date span {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 12px;
}

.msg-actions {
  background: var(--bg2);
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.0666666667);
  border-radius: 7px;
}

.msg:focus-within .msg-actions {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.msg-action {
  color: var(--text2);
  font-size: 11px;
}

.composer {
  margin: 8px 24px 20px;
  border: 1px solid var(--line2);
  border-radius: 12px;
  background: var(--bg2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.0235294118);
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.composer textarea {
  font-size: calc(14px * var(--ui-font-scale));
  min-height: 68px;
  padding: 15px 16px 8px;
  line-height: 1.6;
}

.composer-footer {
  padding: 8px 10px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.composer-send {
  min-height: 34px;
  border-radius: 7px;
}

.composer-hint {
  font-size: 10px;
}

.code-block {
  border-radius: 9px;
  margin-block: 14px;
  border-color: var(--line2);
}

.code-heading {
  background: var(--bg);
  min-height: 36px;
  border-color: var(--line);
}

.code-block pre {
  font-size: 12px;
  line-height: 1.65;
  background: var(--bg3);
}

.msg-body blockquote {
  padding: 8px 14px;
  background: var(--bg);
  border-left: 3px solid var(--line2);
  border-radius: 0 6px 6px 0;
}

pw-scroll-tools {
  display: contents;
}

.jump-latest {
  position: absolute;
  bottom: var(--composer-height, 160px);
  right: 30px;
  z-index: 10;
  border: 1px solid var(--line2);
  background: var(--bg2);
  color: var(--text1);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 12px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1333333333);
  cursor: pointer;
}

.jump-latest[hidden] {
  display: none;
}

.home-welcome {
  padding-bottom: 26px;
  align-items: flex-end;
}

.home-welcome-copy h1 {
  font-size: clamp(26px, 2.6vw, 34px);
  font-weight: 600;
}

.home-stat-grid {
  margin: 20px 0 28px;
  background: var(--bg);
  border: 0;
  border-radius: 10px;
}

.home-stat-grid .stat-card {
  min-height: 82px;
  padding: 14px 22px;
}

.home-stat-grid .stat-value {
  font-size: 24px;
}

.home-stat-grid .stat-label {
  font-size: 12px;
}

.home-stat-grid .stat-note {
  display: none;
}

.home-recent-list .dm-row {
  padding: 18px 12px;
  background: transparent;
}

.home-recent-list .dm-row:hover {
  background: var(--hover-soft);
  text-decoration: none;
}

.home-recent-list .dm-row.unread {
  border-left: 2px solid var(--accent);
}

.home-panel .section-head {
  padding-bottom: 12px;
}

.home-empty {
  background: var(--bg);
  border: 1px dashed var(--line2);
  border-radius: 9px;
  padding: 26px 20px;
  margin-top: 16px;
  text-align: left;
}

.server-welcome {
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--server-accent, var(--accent));
}

.server-hero, .server-create-intro {
  box-shadow: none;
}

.server-hero {
  min-height: 200px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.server-hero:not(.has-banner)::before {
  content: none;
}

.server-hero:not(.has-banner) {
  background: var(--bg3);
}

.server-hero:not(.has-banner) .server-hero-copy {
  color: var(--text1);
}

.server-hero-copy h1 {
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.server-meta-item, .server-role-badge {
  border-radius: 6px;
  min-height: 26px;
  padding: 4px 7px;
}

.server-hero-actions {
  margin-left: 0;
  justify-content: flex-start;
}

.btn.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  flex: 0 0 38px;
  padding: 0;
  border-radius: 9px;
}

.chat-header .btn, .composer-footer .btn, .choice-pill, .segmented-choice .btn {
  border-radius: 7px;
}

.group-add-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.group-add-button .ui-icon {
  width: 17px;
  height: 17px;
}

.modal-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg2);
  scrollbar-gutter: auto;
  border-radius: 14px;
}

.modal-card .modal-head, .modal-card .modal-actions {
  flex: 0 0 auto;
  background: var(--bg2);
}

.modal-card .modal-head {
  padding: 22px 24px 18px;
}

.modal-card .modal-body {
  min-height: 0;
  overflow-y: auto;
  padding: 22px 24px;
}

.modal-card .modal-actions {
  border-top: 1px solid var(--line);
  padding: 16px 24px;
  gap: 8px;
}

.modal-card .modal-actions .btn {
  min-height: 40px;
}

.people-selection-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.people-selection-head b {
  font-size: 13px;
}

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

.people-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.people-selected:not(:empty) {
  margin-bottom: 12px;
}

.person-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid var(--line2);
  border-radius: 6px;
  padding: 7px 9px;
  background: var(--active);
  color: var(--text1);
  font-size: 12px;
  cursor: pointer;
}

.person-chip span {
  font-size: 17px;
}

.people-search {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line2);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text1);
  font-size: 14px;
}

.people-options {
  max-height: 248px;
  overflow-y: auto;
  margin-top: 12px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.people-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.people-option:hover {
  background: var(--hover);
}

.people-option.selected {
  background: var(--active);
  border-color: var(--line2);
}

.people-option:disabled {
  opacity: 0.5;
  cursor: default;
}

.people-option .avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
}

.people-option-copy {
  flex: 1;
  min-width: 0;
}

.people-option-copy b, .people-option-copy small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.people-option-copy b {
  font-size: 13px;
  font-weight: 600;
}

.people-option-copy small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}

.people-check {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line2);
  border-radius: 6px;
  font-size: 15px;
}

.selected .people-check {
  background: var(--action);
  color: var(--on-action);
  border-color: transparent;
}

.people-empty {
  padding: 12px;
  font-size: 13px;
}

.people-manual {
  margin: 14px 0 20px;
  font-size: 12px;
}

.people-manual summary {
  cursor: pointer;
  padding: 8px 0;
  color: var(--text2);
}

.people-manual .field {
  margin-top: 12px;
}

.server-identity-preview {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
  background: var(--bg);
}

.server-preview-banner {
  height: 88px;
  background: var(--bg3);
  border-top: 3px solid var(--server-accent);
}

.server-preview-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.server-preview-identity {
  display: flex;
  gap: 14px;
  padding: 18px;
  align-items: flex-start;
}

.server-preview-identity > div:last-child {
  min-width: 0;
}

.server-preview-identity h3 {
  font-size: 20px;
  margin: 5px 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.server-preview-identity p {
  margin: 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.server-preview-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  overflow: hidden;
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: 12px;
  font-size: 23px;
  font-weight: 600;
}

.server-preview-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.server-customization .field {
  margin-bottom: 22px;
}

.server-customize-preview {
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--server-accent);
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 24px;
}

.accent-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 0;
}

.accent-swatch {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  flex: 0 0 32px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
}

.accent-swatch.active {
  outline: 2px solid var(--text1);
  outline-offset: 3px;
}

/* Settings use a stationary section list and one content scroller. */
.settings-page {
  height: 100%;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

.settings-sidebar {
  width: 184px;
  min-width: 184px;
  padding: 24px 8px;
  background: var(--bg);
}

.settings-nav-label {
  padding: 0 12px 14px;
  font-size: 10px;
  color: var(--muted);
}

.settings-tab {
  margin: 2px 0;
  padding: 10px 12px;
  border-radius: 7px;
  min-height: 40px;
  font-size: 12px;
  color: var(--text2);
}

.settings-tab.active {
  background: var(--active);
  color: var(--text1);
  font-weight: 600;
}

.settings-content {
  background: var(--bg2);
  overscroll-behavior: contain;
}

.settings-content-top {
  padding: 26px 30px 18px;
  min-height: 94px;
  background: var(--bg2);
}

.settings-content-top h1 {
  font-size: 26px;
  font-weight: 600;
}

.settings-user-chip {
  border: 0;
  padding: 0;
  background: transparent;
  font-size: 11px;
}

.settings-search {
  padding: 18px 30px 0;
}

.settings-search input {
  min-height: 40px;
  background: var(--bg);
  border-color: var(--line);
}

.settings-content-inner {
  padding: 24px 30px 36px;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
}

.settings-card-head {
  padding: 22px 0 16px;
}

.settings-card-head h2 {
  font-size: 18px;
  font-weight: 600;
}

.settings-card-head p {
  font-size: 12px;
}

.settings-panel {
  padding: 0 22px;
}

.setting-row {
  min-height: 78px;
  gap: 22px;
  padding: 18px 0;
}

.setting-row b {
  font-size: 13px;
  font-weight: 600;
}

.setting-row small {
  line-height: 1.6;
  font-size: 12px;
}

.profile-settings-card .settings-banner {
  min-height: 132px;
  height: auto;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  background-color: var(--bg);
  border-bottom: 1px solid var(--line);
}

.profile-settings-card .settings-avatar-wrap {
  position: static;
  flex: 0 0 auto;
  margin: 0;
}

.profile-settings-card .settings-avatar-wrap .avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 3px solid var(--bg2);
}

.profile-settings-card .settings-name-block {
  position: static;
  margin: 0;
  padding: 0;
}

.profile-settings-card .settings-name-block h2 {
  font-size: 20px;
  margin: 0 0 5px;
}

.profile-settings-card .settings-name-block p {
  font-size: 12px;
  margin: 0;
}

.profile-settings-card .settings-fields {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.profile-settings-card .field {
  margin: 0;
  min-width: 0;
}

.profile-settings-card .field:nth-child(1), .profile-settings-card .field:nth-child(2), .profile-settings-card .field:nth-child(5), .profile-settings-card .nav-actions {
  grid-column: 1/-1;
}

.profile-settings-card .settings-fields .field textarea {
  min-height: 90px;
}

.file-picker-row {
  flex-wrap: wrap;
  gap: 8px;
}

.file-picker-row small {
  font-size: 10px;
}

.settings-fields > .nav-actions {
  position: sticky;
  bottom: -36px;
  background: var(--bg2);
  padding: 16px 0;
  margin: 0;
  border-top: 1px solid var(--line);
}

.call-overlay.expanded {
  background: var(--bg2);
}

.call-user-row, .call-input-panel, .call-health, pw-screen-settings {
  background: var(--bg);
}

.call-health-heading {
  align-items: center;
}

.call-health-score {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 12px 0;
}

.call-health-score strong {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

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

.call-health-sparkline {
  display: block;
  width: 100%;
  height: 36px;
  margin-bottom: 10px;
  color: var(--accent);
}

.call-health-native {
  display: inline-block;
  padding: 3px 7px;
  margin-bottom: 8px;
  font-size: 10px;
  border-radius: 4px;
  color: var(--text2);
  background: var(--bg2);
  border: 1px solid var(--line);
}

.quick-switcher {
  position: fixed;
  inset: 12vh auto auto 50%;
  transform: translateX(-50%);
  width: min(560px, 100vw - 24px);
  max-height: min(640px, 78dvh);
  padding: 0;
  margin: 0;
  border: 1px solid var(--line2);
  border-radius: 14px;
  background: var(--bg2);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3333333333);
  overflow: hidden;
}

.quick-switcher::backdrop {
  background: rgba(10, 22, 27, 0.5019607843);
}

.switcher-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.switcher-heading input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text1);
  font-size: 16px;
  padding: 8px;
  outline: 0;
}

.switcher-close {
  border: 1px solid var(--line2);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text2);
  font-size: 10px;
  padding: 7px;
  cursor: pointer;
}

.switcher-results {
  padding: 8px;
  overflow-y: auto;
  max-height: min(470px, 53dvh);
  overscroll-behavior: contain;
}

.switcher-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.switcher-result.selected, .switcher-result:hover {
  background: var(--active);
}

.switcher-initial {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--line2);
  border-radius: 9px;
  font-size: 13px;
  color: var(--text2);
}

.switcher-copy {
  min-width: 0;
}

.switcher-copy b, .switcher-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switcher-copy b {
  font-size: 13px;
  font-weight: 600;
}

.switcher-copy small {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.switcher-footer, .switcher-empty {
  padding: 14px 20px;
  font-size: 11px;
  color: var(--muted);
}

.switcher-footer {
  border-top: 1px solid var(--line);
  background: var(--bg);
}

@media (max-width: 1100px) and (min-width: 761px) {
  .settings-sidebar {
    width: 156px;
    min-width: 156px;
  }
  .settings-content-top, .settings-content-inner {
    padding-inline: 20px;
  }
  .settings-search {
    padding-inline: 20px;
  }
  .settings-user-chip {
    display: none;
  }
  .profile-settings-card .settings-fields {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .side {
    position: fixed;
  }
  .main {
    background: var(--bg2);
  }
  .side .list > .row:not(.dm-row) {
    min-height: 44px;
  }
  .side .dm-row {
    min-height: 64px;
  }
  .sidebar-resize {
    display: none;
  }
  .side-head {
    padding-top: 20px;
  }
  .chat-header {
    height: 64px;
    padding-inline: 14px;
  }
  .messages {
    padding: 12px 12px 20px;
  }
  .msg {
    padding: 11px 2px;
    gap: 10px;
  }
  .msg .avatar {
    width: 30px;
    height: 30px;
  }
  .msg-body {
    font-size: 14px;
  }
  .composer {
    margin: 4px 10px 10px;
  }
  .composer textarea {
    font-size: 16px;
    min-height: 60px;
    padding: 12px;
  }
  .composer-footer {
    padding: 5px 7px;
    gap: 4px;
  }
  .composer-send, .composer-action {
    min-height: 42px;
  }
  .composer-hint {
    display: none;
  }
  .jump-latest {
    right: 16px;
    min-height: 44px;
  }
  .content {
    background: var(--bg2);
  }
  .home-welcome {
    align-items: flex-start;
    gap: 18px;
  }
  .home-stat-grid .stat-card {
    padding: 12px;
    min-height: 76px;
  }
  .home-recent-list .dm-row {
    padding: 15px 8px;
  }
  .settings-page {
    overflow: hidden;
  }
  .settings-mobile-nav {
    flex-shrink: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px 12px;
  }
  .settings-content-top {
    padding: 20px 18px 16px;
    min-height: 80px;
  }
  .settings-content-top h1 {
    font-size: 24px;
  }
  .settings-search {
    padding: 12px 16px 0;
  }
  .settings-content-inner {
    padding: 18px 14px 30px;
  }
  .settings-panel {
    padding-inline: 16px;
  }
  .setting-row {
    gap: 14px;
  }
  .profile-settings-card .settings-fields {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }
  .profile-settings-card .settings-banner {
    padding: 20px;
  }
  .field input, .field textarea, .field select, .settings-search input {
    font-size: 16px;
  }
  .settings-fields > .nav-actions {
    bottom: -30px;
  }
  .quick-switcher {
    top: max(24px, env(safe-area-inset-top));
  }
  .switcher-result {
    min-height: 60px;
  }
  .switcher-close {
    min-width: 40px;
    min-height: 40px;
  }
}
[data-density=compact] .side .dm-row {
  min-height: 48px;
  padding-block: 7px;
}

[data-density=compact] .msg {
  padding-block: 5px;
}

[data-font-scale=large] .dm-name, [data-font-scale=large] .settings-tab {
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
  }
}
/* Retain accent preferences while keeping text readable in either theme. */
:root .btn:not(.secondary):not(.ghost):not(.icon-btn):not(.call-decline):not(.call-accept):not(.danger) {
  background: var(--action);
  color: var(--on-action);
}
:root .btn:not(.secondary):not(.ghost):not(.icon-btn):not(.call-decline):not(.call-accept):not(.danger):hover {
  background: var(--action);
  color: var(--on-action);
}

.msg-body a, .home-recent-list .dm-name {
  color: var(--action);
}

.side .side-section-heading .btn {
  background: var(--bg2);
  color: var(--text2);
}

/* Compact touch layouts preserve navigation and modal actions at short heights. */
@media (max-width: 760px) {
  .side {
    width: min(340px, 100vw - 20px);
    max-width: calc(100vw - 20px);
    padding-top: env(safe-area-inset-top);
  }
  .side-head {
    padding: 24px 20px 18px;
  }
  .server-side-head .nav-actions .btn {
    min-height: 42px;
    font-size: 12px;
  }
  .side-close, .chat-mobile-menu {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    flex: 0 0 40px;
    padding: 0;
    border-radius: 9px;
  }
  .side .channel-link {
    min-height: 46px;
  }
  .main .content {
    padding-inline: 16px;
  }
  .route-chat .content, .route-settings .content {
    padding: 0;
  }
  .topbar {
    padding-inline: 16px;
  }
  .chat-header {
    gap: 9px;
  }
  .chat-header .grow {
    min-width: 0;
  }
  .chat-header h2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
  }
  .chat-header .btn {
    min-height: 40px;
  }
  .chat-header .group-add-button {
    width: 40px;
    min-width: 40px;
    padding: 0;
    justify-content: center;
    flex: 0 0 40px;
  }
  .group-add-label {
    display: none;
  }
  .composer {
    margin-inline: 12px;
  }
  .composer-action:not(.composer-send) {
    width: 40px;
    min-width: 40px !important;
    height: 42px;
    flex: 0 0 40px;
    padding: 0 !important;
    border-radius: 7px !important;
  }
  .server-hero {
    padding: 22px 18px;
    gap: 20px;
    min-height: 0;
  }
  .server-hero-main {
    gap: 12px;
  }
  .server-hero-main .server-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 12px;
  }
  .server-hero-copy h1 {
    font-size: 25px;
    line-height: 1.2;
  }
  .server-hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .server-hero-actions .btn {
    min-height: 44px;
    padding-inline: 10px;
  }
  .server-hero-actions .btn:first-child {
    grid-column: 1/-1;
  }
  .modal {
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }
  .modal-card, .action-modal {
    max-height: min(94dvh, var(--pw-visual-height, 100dvh) - 20px);
    border-radius: 14px;
  }
  .modal-card .modal-head {
    padding: 18px;
  }
  .modal-card .modal-head h2 {
    font-size: 21px;
  }
  .modal-card .modal-body {
    padding: 18px;
  }
  .modal-card .modal-actions {
    padding: 12px 18px;
  }
  .modal-card .modal-actions .btn {
    min-height: 44px;
  }
  .people-search {
    font-size: 16px;
  }
  .people-options {
    max-height: 216px;
  }
  .people-option {
    min-height: 62px;
  }
  .person-chip {
    min-height: 36px;
  }
  .accent-swatch {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
  .server-preview-identity {
    padding: 16px;
  }
  .settings-mobile-nav {
    scrollbar-width: thin;
  }
}
/* Message interaction surfaces. Layout/behavior lives in SCSS; theme values
   are supplied by _theme-hooks.less so custom client themes have a small API. */
.dm-preview-sender {
  color: var(--text2);
  font-weight: 650;
}

.forwarded-message-origin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin: 1px 0 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 620;
  cursor: pointer;
}
.forwarded-message-origin:hover {
  color: var(--text1);
}
.forwarded-message-origin:focus-visible {
  border-radius: 4px;
  outline-offset: 2px;
}

.forwarded-icon {
  font-size: 13px;
  line-height: 1;
}

.message-editor {
  display: grid;
  gap: 8px;
  width: min(100%, 760px);
}

.message-edit-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 76px;
  max-height: 220px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--line2);
  border-radius: 7px;
  background: var(--bg2);
  color: var(--text1);
  font: inherit;
  line-height: 1.45;
}
.message-edit-input:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent), transparent 84%);
}

.message-edit-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.message-edit-actions small {
  margin-right: auto;
}
.message-edit-actions .btn {
  min-height: 30px;
  padding: 5px 10px;
}

.message-edited {
  margin-left: 5px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.forward-modal {
  display: grid;
  gap: 18px;
}

.forward-preview {
  padding: 12px 14px;
  border: 1px solid var(--pw-forward-border, var(--line));
  border-left: 3px solid var(--accent);
  border-radius: 7px;
  background: var(--pw-forward-surface, var(--bg));
}

.forward-preview-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.forward-preview-body {
  max-height: 110px;
  overflow: hidden;
  color: var(--text1);
  line-height: 1.45;
}

.forward-search {
  margin-bottom: -4px;
}

.forward-empty {
  padding: 14px 12px;
  border: 1px dashed var(--line2);
  border-radius: 7px;
  text-align: center;
}

.forward-section {
  display: grid;
  gap: 7px;
}

.forward-section > b {
  font-size: 12px;
}

.forward-targets {
  display: grid;
  gap: 3px;
  max-height: 190px;
  overflow: auto;
  overscroll-behavior: contain;
}

.forward-target {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.forward-target:hover, .forward-target:focus-visible {
  border-color: var(--line);
  background: var(--hover);
}

.forward-target-hash {
  color: var(--muted);
  font-size: 17px;
  text-align: center;
}

.forward-target-arrow {
  color: var(--muted);
  transition: transform 0.12s ease;
}

.forward-target:hover .forward-target-arrow {
  transform: translateX(2px);
  color: var(--text1);
}

.shortcut-sheet {
  display: grid;
  gap: 2px;
}

.shortcut-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 42px;
  padding: 7px 2px;
  border-bottom: 1px solid var(--line);
}
.shortcut-row:last-child {
  border-bottom: 0;
}

.shortcut-key {
  max-width: 230px;
  padding: 4px 7px;
  border: 1px solid var(--line2);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--pw-key-surface, var(--bg3));
  color: var(--text1);
  font: 600 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: right;
  white-space: nowrap;
}

.emoji-picker {
  display: grid;
  gap: 14px;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  max-height: min(48vh, 430px);
  overflow: auto;
  padding: 2px;
  overscroll-behavior: contain;
}

.emoji-picker-item {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 66px;
  padding: 7px 5px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--pw-emoji-surface, var(--bg2));
  color: var(--text1);
  cursor: pointer;
  transition: background-color 0.11s ease, border-color 0.11s ease, transform 0.11s ease;
}
.emoji-picker-item:hover, .emoji-picker-item:focus-visible {
  border-color: var(--line2);
  background: var(--pw-emoji-hover, var(--hover));
  outline: 0;
}
.emoji-picker-item:active {
  transform: translateY(1px);
}

.emoji-picker-glyph {
  font-size: 26px;
  line-height: 1;
}

.emoji-picker-code {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font: 600 9px/1.15 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emoji-picker-hint {
  margin: 0;
}

.ctx-menu {
  box-shadow: var(--pw-context-shadow, 0 14px 34px rgba(0, 0, 0, 0.18));
}

@media (max-width: 620px) {
  .message-edit-actions {
    align-items: flex-end;
    flex-wrap: wrap;
  }
  .message-edit-actions small {
    flex: 1 0 100%;
  }
  .forward-targets {
    max-height: 150px;
  }
  .shortcut-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .shortcut-key {
    justify-self: start;
    text-align: left;
  }
  .emoji-picker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .emoji-picker-item {
    min-height: 60px;
  }
}
.voice-note-recorder .voice-note-live {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 0;
  font-variant-numeric: tabular-nums;
}

.voice-note-live-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--danger, #d84b4b);
  box-shadow: 0 0 0 0.3rem color-mix(in srgb, var(--danger, #d84b4b) 18%, transparent);
}

.voice-note-live-dot.stopped {
  background: var(--muted);
  box-shadow: none;
}

.voice-note-player {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: min(28rem, 100%);
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--surface2);
}

.voice-note-player audio {
  width: min(26rem, 100%);
  height: 2.3rem;
}

.voice-note-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 650;
}

.composer-action-voice {
  font-size: 0.72rem;
  line-height: 1;
}

.account-destructive-warning {
  padding: 0.7rem 0.8rem;
  border: 1px solid color-mix(in srgb, var(--danger, #d84b4b) 45%, var(--border));
  border-radius: 0.7rem;
  background: color-mix(in srgb, var(--danger, #d84b4b) 8%, transparent);
}

.danger-zone-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
:root,
[data-theme="light"] {
  --bg: #f7f8fa;
  --bg2: #ffffff;
  --bg3: #f0f2f5;
  --bg4: #e7eaf0;
  --text: #344054;
  --text1: #101828;
  --text2: #475467;
  --muted: #667085;
  --line: #e4e7ec;
  --line2: #cfd5df;
  --hover: #f1f4f8;
  --hover-soft: #f8f9fb;
  --active: #e8eef8;
  --accent: #41679f;
  --accent2: #345580;
  --action: var(--accent);
  --action-hover: #3b6097;
  --on-action: #ffffff;
  --danger: #b4233b;
  --ok: #18794e;
  --control-radius: 10px;
  --card-radius: 14px;
  --panel-radius: 0px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 2px 8px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 12px 30px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, 0.16);
  --float-shadow: 0 5px 18px rgba(16, 24, 40, 0.07);
  --content-max: 1180px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #181b21;
  --bg2: #1e2229;
  --bg3: #12151a;
  --bg4: #0d1014;
  --text: #d7dce5;
  --text1: #f6f7f9;
  --text2: #b2bac7;
  --muted: #919baa;
  --line: #303640;
  --line2: #444d5a;
  --hover: #272c34;
  --hover-soft: #232830;
  --active: #2b374a;
  --accent: #9bb7e4;
  --accent2: #bdd0ed;
  --action: #adc4e7;
  --action-hover: #a8c1e9;
  --on-action: #162234;
  --danger: #f07787;
  --ok: #5bd19a;
  --control-radius: 10px;
  --card-radius: 14px;
  --panel-radius: 0px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.18);
  --shadow-sm: 0 3px 10px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 28px 72px rgba(0, 0, 0, 0.46);
  --float-shadow: 0 5px 18px rgba(0, 0, 0, 0.4);
  --content-max: 1180px;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #181b21;
    --bg2: #1e2229;
    --bg3: #12151a;
    --bg4: #0d1014;
    --text: #d7dce5;
    --text1: #f6f7f9;
    --text2: #b2bac7;
    --muted: #919baa;
    --line: #303640;
    --line2: #444d5a;
    --hover: #272c34;
    --hover-soft: #232830;
    --active: #2b374a;
    --accent: #9bb7e4;
    --accent2: #bdd0ed;
    --action: #adc4e7;
    --action-hover: #a8c1e9;
    --on-action: #162234;
    --danger: #f07787;
    --ok: #5bd19a;
    --control-radius: 10px;
    --card-radius: 14px;
    --panel-radius: 0px;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.18);
    --shadow-sm: 0 3px 10px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 28px 72px rgba(0, 0, 0, 0.46);
    --float-shadow: 0 5px 18px rgba(0, 0, 0, 0.4);
    --content-max: 1180px;
    color-scheme: dark;
  }
}
* {
  box-sizing: border-box;
}
html {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
html,
body {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  background: var(--bg3);
}
body {
  color: var(--text);
}
::selection {
  color: var(--text1);
  background: color-mix(in srgb, var(--accent), transparent 72%);
}
a {
  color: var(--action);
  text-underline-offset: 2px;
}
hr {
  border-color: var(--line);
}
button,
input,
textarea,
select {
  letter-spacing: inherit;
}
:where(button, a, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent), white 12%);
  outline-offset: 2px;
}
.btn {
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  background: var(--action);
  color: var(--on-action);
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  box-shadow: var(--shadow-xs) !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.btn:hover {
  background: var(--action-hover);
  color: var(--on-action);
  box-shadow: var(--shadow-sm) !important;
}
.btn:active {
  transform: translateY(1px);
  box-shadow: none !important;
}
.btn.secondary,
label.btn.secondary {
  border-color: var(--line2);
  background: var(--bg2);
  color: var(--text1);
}
.btn.secondary:hover,
.btn.ghost:hover,
.btn.icon-btn:hover {
  border-color: color-mix(in srgb, var(--line2), var(--text2) 25%);
  background: var(--hover);
  color: var(--text1);
}
.btn.ghost,
.btn.icon-btn {
  border-color: transparent;
  background: transparent;
  color: var(--text2);
  box-shadow: none !important;
}
.btn.danger,
.btn.call-decline {
  background: #b4233b;
  color: #fff;
}
.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none;
}
.btn.icon-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 11px;
}
.field {
  min-width: 0;
}
.field label {
  margin-bottom: 7px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}
.field input,
.field select,
.field textarea,
.settings-search input,
.people-search,
.forum-search-input {
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line2);
  border-radius: var(--control-radius);
  background: var(--bg2);
  color: var(--text1);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.field textarea {
  line-height: 1.55;
}
.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: color-mix(in srgb, var(--line2), var(--text2) 20%);
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.settings-search input:focus,
.people-search:focus,
.forum-search-input:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 82%);
}
::placeholder {
  color: var(--muted);
  opacity: 0.82;
}
.card,
.settings-card,
.forum-card,
.forum-thread,
.notifications-list,
.search-result-section {
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--bg2);
  box-shadow: var(--shadow-xs);
}
.card.pad {
  padding: 24px;
}
.eyebrow {
  color: var(--action);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.muted {
  color: var(--muted);
}
.badge {
  min-width: 19px;
  height: 19px;
  padding-inline: 6px;
  border-radius: 999px;
  background: var(--action);
  color: var(--on-action);
  font-size: 10px;
  font-weight: 750;
  box-shadow: 0 0 0 2px var(--bg);
}
.avatar,
.server-icon {
  background: var(--bg4);
  color: var(--text2);
}
.avatar {
  border-radius: 12px;
}
.presence-avatar {
  flex: 0 0 auto;
}
.modal {
  padding: clamp(12px, 3vw, 32px);
  background: rgba(9, 13, 20, 0.56);
  backdrop-filter: blur(5px);
}
.modal-card,
.action-modal {
  max-width: min(620px, 100%);
  max-height: min(86dvh, 820px);
  border: 1px solid var(--line);
  border-radius: 0px;
  background: var(--bg2);
  box-shadow: var(--shadow-lg);
}
.modal-card .modal-head {
  padding: 24px 26px 19px;
  border-bottom: 1px solid var(--line);
}
.modal-card .modal-head h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.025em;
}
.modal-card .modal-body {
  padding: 24px 26px;
}
.modal-card .modal-actions {
  padding: 16px 26px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.modal-card .modal-actions .btn {
  min-height: 42px;
}
.quick-switcher {
  top: 11vh;
  width: min(620px, calc(100vw - 28px));
  max-height: min(680px, 78dvh);
  border-color: var(--line2);
  border-radius: 0px;
  box-shadow: var(--shadow-lg);
}
.quick-switcher::backdrop {
  background: rgba(9, 13, 20, 0.56);
  backdrop-filter: blur(4px);
}
.switcher-heading {
  padding: 17px 18px;
}
.switcher-heading input {
  min-height: 42px;
  font-size: 17px;
}
.switcher-results {
  padding: 9px;
}
.switcher-result {
  min-height: 58px;
  padding: 11px 13px;
  border-radius: 11px;
}
.switcher-result.selected,
.switcher-result:hover {
  background: var(--active);
}
.switcher-footer {
  padding: 13px 20px;
}
.toast {
  top: 22px;
  right: 22px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 12px 12px 15px;
  border: 1px solid var(--line2);
  border-radius: 12px;
  background: var(--bg2);
  color: var(--text1);
  box-shadow: var(--shadow-md);
}
.toast-close {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}
:where(.content, .side .list, .settings-content, .messages, .modal-body, .call-overlay, .people-options, .switcher-results) {
  scrollbar-width: thin;
  scrollbar-color: var(--line2) transparent;
  overscroll-behavior: contain;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
:root,
[data-theme="light"],
[data-theme="dark"] {
  --rail-w: 62px;
  --side-w: 274px;
  --right-w: 248px;
  --header-h: 70px;
  --navigation-width: 274px;
}
@media (min-width: 761px) {
  .layout {
    gap: 10px;
    padding: 10px;
    background: var(--bg3);
  }
  .rail,
  .side,
  .main,
  .right {
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: var(--panel-radius);
    background: var(--bg2);
    box-shadow: var(--shadow-xs);
  }
  .rail {
    width: var(--rail-w);
    padding: 12px 0;
    gap: 7px;
    overflow-x: hidden;
    background: var(--bg2);
  }
  .side {
    width: clamp(240px, var(--navigation-width), 340px);
    overflow: hidden;
    background: var(--bg);
  }
  .main {
    overflow: hidden;
    isolation: isolate;
  }
  .right {
    width: var(--right-w);
    border-left: 1px solid var(--line);
    background: var(--bg);
  }
  .topbar {
    height: var(--header-h);
    min-height: var(--header-h);
    padding: 0 30px;
    border-bottom: 1px solid var(--line);
    border-radius: var(--panel-radius) var(--panel-radius) 0 0;
    background: color-mix(in srgb, var(--bg2), var(--bg) 12%);
  }
  .content {
    padding: clamp(28px, 3vw, 42px);
  }
  .route-chat .topbar {
    display: none;
  }
  .route-chat .content,
  .route-settings .content {
    padding: 0;
  }
}
.rail .mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  margin: 0 0 10px;
  padding: 0;
  border: 1px solid var(--line2);
  border-radius: 13px;
  background: var(--text1);
  color: var(--bg2);
  box-shadow: var(--shadow-sm);
  font: 750 20px/1 Inter, system-ui, sans-serif;
  cursor: pointer;
}
.rail .mark::after {
  content: none;
}
.rail .mark:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.rail-btn,
.rail-btn .server-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
}
.rail-btn {
  overflow: visible;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.rail-btn:hover,
.rail-btn.active {
  border-radius: 12px;
  background: var(--active);
  color: var(--accent);
  transform: none;
}
.rail-btn::before {
  left: -10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.rail-btn.active::before {
  height: 24px;
}
.side-head {
  flex: 0 0 auto;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg), var(--bg2) 45%);
}
.side-title-row {
  gap: 12px;
  min-width: 0;
}
.side-title-copy {
  min-width: 0;
}
.side-head h1 {
  margin: 0;
  color: var(--text1);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.side-title-copy small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}
.side-head .nav-actions {
  gap: 7px;
  margin-top: 16px;
}
.side-head .nav-actions .btn {
  min-height: 34px;
  padding-inline: 10px;
  font-size: 11px;
}
.workspace-menu {
  margin-top: 15px;
}
.workspace-menu > summary {
  min-height: 34px;
  margin-inline: -8px;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
}
.workspace-menu > summary:hover {
  background: var(--hover);
  color: var(--text1);
}
.workspace-menu-items {
  top: calc(100% + 5px);
  left: -8px;
  right: -8px;
  padding: 6px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}
.workspace-menu-items .btn {
  min-height: 38px;
  padding-inline: 11px;
  border-radius: 8px;
}
.side .search {
  display: grid;
  gap: 9px;
  padding: 16px 16px 12px;
}
.quick-jump-button {
  min-height: 42px;
  padding: 9px 11px;
  border-color: var(--line2);
  border-radius: 10px;
  background: var(--bg2);
  color: var(--text2);
  box-shadow: var(--shadow-xs);
  font-size: 12px;
}
.quick-jump-button:hover {
  border-color: color-mix(in srgb, var(--line2), var(--text2) 25%);
  background: var(--hover-soft);
  color: var(--text1);
}
.quick-jump-button kbd {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
}
#globalSearch {
  height: 36px;
  min-height: 36px;
  padding: 7px 10px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}
#globalSearch:hover,
#globalSearch:focus {
  border-color: var(--line);
  background: var(--bg2);
}
.side .list {
  padding: 2px 10px 18px;
}
.side .list > .row:not(.dm-row) {
  min-height: 42px;
  margin-block: 2px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--text2);
}
.side .list > .row:not(.dm-row) b {
  font-size: 13px;
  font-weight: 600;
}
.side .row:hover {
  background: var(--hover);
  color: var(--text1);
  text-decoration: none;
}
.side .row.active,
.side .dm-row.active {
  background: var(--active);
  color: var(--text1);
  box-shadow: inset 3px 0 0 var(--accent);
}
.side .nav-symbol {
  width: 24px;
  height: 24px;
  color: var(--muted);
}
.side .nav-symbol .ui-icon {
  width: 17px;
  height: 17px;
}
.side .side-section-heading {
  padding: 23px 9px 8px;
}
.side .side-section-heading b,
.channel-group-title {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.side .side-section-heading .btn {
  min-height: 28px;
  padding: 4px 9px;
  border-color: var(--line);
  border-radius: 7px;
  background: var(--bg2);
  color: var(--text2);
  font-size: 10px;
}
.side .dm-row {
  min-height: 64px;
  margin-block: 2px;
  padding: 10px 9px;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}
.side .dm-row:hover {
  background: var(--hover);
}
.side .dm-row .avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
}
.dm-row-head {
  gap: 8px;
}
.dm-row-head b {
  color: var(--text1);
  font-size: 13px;
  font-weight: 600;
}
.dm-row-head small {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.dm-preview {
  display: block;
  min-width: 0;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.dm-preview pw-markdown {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.dm-preview pw-markdown :where(strong, em, code, a) {
  color: inherit;
  font-size: inherit;
}
.dm-preview pw-markdown a {
  text-decoration: none;
}
.side .dm-row.unread .dm-row-head b {
  font-weight: 750;
}
.side .dm-row.unread .dm-preview {
  color: var(--text2);
}
.user-panel {
  min-height: 72px;
  gap: 10px;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg), var(--bg2) 38%);
}
.user-panel .avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
}
.user-panel b {
  color: var(--text1);
  font-size: 13px;
  font-weight: 650;
}
.user-panel small {
  font-size: 10px;
}
.user-panel-actions button {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}
.server-channel-list {
  padding-inline: 12px !important;
}
.channel-group-title {
  margin: 22px 8px 8px;
}
.channel-link {
  min-height: 46px;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 9px;
}
.channel-glyph {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  border-radius: 9px;
  background: var(--bg2);
}
.category-actions .ctx-trigger {
  width: 24px;
  height: 24px;
}
.sidebar-resize {
  right: -6px;
  width: 12px;
}
.sidebar-resize:hover,
.sidebar-resize:focus-visible {
  background: transparent;
}
.sidebar-resize:hover::after,
.sidebar-resize:focus-visible::after {
  content: "";
  position: absolute;
  inset: 10px 5px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.55;
}
.topbar-title {
  min-width: 0;
}
.topbar-title h2 {
  color: var(--text1);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.topbar-title small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.members-panel h3 {
  padding: 21px 18px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.08em;
}
.right .list {
  padding: 9px;
}
@media (max-width: 1180px) and (min-width: 761px) {
  :root {
    --navigation-width: 244px;
  }
  .right {
    display: none;
  }
  .layout {
    gap: 8px;
    padding: 8px;
  }
}
@media (max-width: 760px) {
  .layout {
    gap: 0;
    padding: 0 0 calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
    background: var(--bg2);
  }
  [data-mobile-keyboard="open"] .layout {
    padding-bottom: 0;
  }
  .main,
  .chat-surface {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .content {
    padding: 22px 16px;
  }
  .route-chat .content,
  .route-settings .content {
    padding: 0;
  }
  .side {
    position: fixed;
    width: min(350px, calc(100vw - 18px));
    max-width: calc(100vw - 18px);
    padding-top: env(safe-area-inset-top);
    border: 0;
    border-radius: 0 0px 0px 0;
    background: var(--bg);
    box-shadow: var(--shadow-lg);
  }
  .side-head {
    padding: 22px 20px 18px;
  }
  .side .list > .row:not(.dm-row) {
    min-height: 46px;
  }
  .side .dm-row {
    min-height: 66px;
  }
  .side-close,
  .chat-mobile-menu {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    border-radius: 11px;
  }
  .mobile-nav {
    height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
    padding: 6px 8px max(6px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg2), transparent 4%);
    box-shadow: 0 -8px 24px rgba(16, 24, 40, 0.06);
    backdrop-filter: blur(18px);
  }
  .mobile-nav-btn {
    min-width: 54px;
    min-height: 48px;
    padding: 4px 6px;
    border-radius: 11px;
    color: var(--muted);
  }
  .mobile-nav-btn.active {
    background: transparent;
    color: var(--accent);
  }
  .mobile-nav-icon-wrap {
    width: 34px;
    height: 27px;
    border-radius: 9px;
  }
  .mobile-nav-btn.active .mobile-nav-icon-wrap {
    background: var(--active);
  }
  .mobile-nav-label {
    font-size: 10px;
    font-weight: 650;
  }
  .toast {
    top: calc(72px + env(safe-area-inset-top));
    right: 12px;
    left: 12px;
  }
}
.home-page,
.forum-page,
.server-page,
.thread-page,
.dm-inbox,
.friends-page,
.notifications-page,
.search-page {
  width: min(var(--content-max), 100%);
  margin-inline: auto;
}
.home-page {
  gap: 0;
}
.home-welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  min-height: 166px;
  margin: 0;
  padding: 30px 32px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: color-mix(in srgb, var(--bg2), var(--accent) 3%);
  box-shadow: var(--shadow-xs);
}
.home-welcome-copy h1 {
  margin: 8px 0 7px;
  color: var(--text1);
  font-size: clamp(30px, 3vw, 40px);
  font-weight: 680;
  line-height: 1.1;
  letter-spacing: -0.045em;
}
.home-welcome-copy p {
  max-width: 52ch;
  margin: 0;
  color: var(--text2);
  font-size: 14px;
}
.home-primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.home-primary-actions .btn {
  min-height: 42px;
}
.home-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 24px;
  overflow: visible;
  border: 0;
  background: transparent;
}
.home-stat-grid .stat-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 94px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg2);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  text-align: left;
}
.home-stat-grid .stat-card:hover {
  border-color: color-mix(in srgb, var(--accent), var(--line) 60%);
  background: var(--hover-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.home-stat-grid .stat-value {
  min-width: 38px;
  margin: 0;
  color: var(--text1);
  font-size: 28px;
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.04em;
}
.stat-card-copy {
  min-width: 0;
}
.stat-card-copy b,
.stat-card-copy small {
  display: block;
}
.stat-card-copy b {
  overflow: hidden;
  color: var(--text1);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
}
.stat-card-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.stat-card-arrow {
  color: var(--muted);
  font-size: 17px;
  transition: transform 0.15s ease, color 0.15s ease;
}
.stat-card:hover .stat-card-arrow {
  color: var(--accent);
  transform: translateX(2px);
}
.home-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
}
.home-panel {
  min-width: 0;
  padding: 22px !important;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--bg2);
}
.home-panel .section-head {
  margin: 0;
  padding: 0 0 15px;
  border-bottom: 1px solid var(--line);
}
.home-panel .section-head h2 {
  margin: 0;
  color: var(--text1);
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.015em;
}
.home-panel .section-head p {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.5;
}
.home-panel .section-head .btn {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 11px;
}
.home-recent-list .dm-row,
.home-activity-row {
  width: 100%;
  min-height: 72px;
  margin: 0;
  padding: 12px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  text-align: left;
}
.home-recent-list .dm-row:hover,
.home-activity-row:hover {
  background: var(--hover-soft);
  text-decoration: none;
}
.home-recent-list .dm-row:last-child,
.home-activity-row:last-child {
  border-bottom: 0;
}
.home-recent-list .dm-row.unread {
  border-left: 0;
}
.home-recent-list .dm-row .avatar {
  width: 40px;
  height: 40px;
  border-radius: 13px;
}
.home-recent-list .dm-row-head b {
  font-size: 14px;
}
.home-recent-list .dm-preview {
  font-size: 12px;
}
.home-activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.home-activity-mark {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--line2);
}
.home-activity-row.unseen .home-activity-mark {
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent), transparent 86%);
}
.home-activity-copy {
  min-width: 0;
}
.home-activity-copy b,
.home-activity-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-activity-copy b {
  color: var(--text1);
  font-size: 12px;
  font-weight: 620;
}
.home-activity-copy small {
  margin-top: 3px;
  font-size: 10px;
}
.home-empty {
  min-height: 132px;
  margin: 12px 0 0;
  padding: 28px 20px;
  border: 1px dashed var(--line2);
  border-radius: 11px;
  background: var(--bg);
  font-style: normal;
  text-align: center;
}
.home-empty b {
  display: block;
  color: var(--text1);
  font-size: 13px;
}
.home-empty p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.home-quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.chat-surface {
  position: relative;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: var(--bg2);
  box-shadow: none;
}
.chat-header {
  z-index: 8;
  height: 70px;
  min-height: 70px;
  padding: 11px 28px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg2), transparent 3%);
  backdrop-filter: blur(16px);
}
.chat-header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 13px;
}
.chat-header h2 {
  color: var(--text1);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.chat-header small {
  max-width: min(54vw, 720px);
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-header .btn {
  min-height: 40px;
  padding-inline: 13px;
}
.chat-call-action {
  border: 1px solid var(--line2);
  background: var(--bg2);
  color: var(--text1);
}
.chat-call-action:hover {
  background: var(--hover);
  color: var(--text1);
}
.channel-header-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: var(--bg);
  color: var(--muted);
  font: 600 20px/1 ui-monospace, monospace;
}
.messages {
  min-height: 0;
  padding: 18px max(24px, calc((100% - 980px) / 2)) 26px;
  background: var(--bg2);
  scroll-padding-block: 20px 34px;
}
.message-history-sentinel,
.message-date,
.msg {
  width: min(980px, 100%);
  margin-inline: auto;
  flex-shrink: 0;
}
.message-history-sentinel {
  padding: 7px 0;
}
.msg {
  min-width: 0;
  gap: 13px;
  margin-block: 0;
  padding: 11px 10px;
  border-radius: 10px;
  background: transparent;
  contain: layout style;
}
.msg:hover,
.msg.mine:hover {
  background: var(--hover-soft);
  box-shadow: none;
}
.msg.compact {
  padding-block: 4px;
}
.msg > .avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 12px;
}
.msg-main {
  min-width: 0;
}
.msg-head {
  gap: 9px;
  margin-bottom: 4px;
}
.msg-name {
  color: var(--text1);
  font-size: 13px;
  font-weight: 680;
  letter-spacing: -0.01em;
}
.msg-time {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.msg-body {
  max-width: 82ch;
  color: var(--text);
  font-size: calc(14px * var(--ui-font-scale));
  line-height: 1.64;
  overflow-wrap: anywhere;
}
.msg-body pw-markdown p {
  margin: 0.35em 0;
}
.message-date {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-block: 22px 16px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}
.message-date::before,
.message-date::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}
.message-date span {
  padding: 4px 10px;
  border: 0;
  background: transparent;
  white-space: nowrap;
}
.msg-actions {
  top: -10px;
  right: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg2);
  box-shadow: var(--shadow-sm);
}
.msg:focus-within .msg-actions {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.msg-action {
  min-height: 32px;
  padding: 5px 10px;
  color: var(--text2);
  font-size: 11px;
}
.reply-preview {
  border-radius: 9px;
  background: var(--bg);
}
.call-event {
  content-visibility: visible;
  contain-intrinsic-size: none;
  contain: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: min(720px, calc(100% - 20px));
  min-height: 70px;
  margin-block: 8px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg), var(--bg2) 44%);
  box-shadow: var(--shadow-xs);
}
.call-event:hover,
.call-event.mine:hover {
  background: color-mix(in srgb, var(--hover-soft), var(--bg2) 28%);
  box-shadow: var(--shadow-xs);
}
.call-event-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger), transparent 88%);
  color: var(--danger);
}
.call-event.mine .call-event-icon {
  background: color-mix(in srgb, var(--muted), transparent 88%);
  color: var(--text2);
}
.call-event-icon .ui-icon {
  width: 19px;
  height: 19px;
  transform: rotate(135deg);
}
.call-event.mine .call-event-icon .ui-icon {
  transform: none;
}
.call-event-copy {
  min-width: 0;
}
.call-event-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.call-event-heading b {
  color: var(--text1);
  font-size: 13px;
  font-weight: 680;
}
.call-event-time {
  color: var(--muted);
  font-size: 10px;
}
.call-event-copy small {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.call-event-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding-inline: 12px;
  white-space: nowrap;
}
.call-event-action .ui-icon {
  width: 15px;
  height: 15px;
}
.code-block {
  margin-block: 12px;
  border-color: var(--line2);
  border-radius: 10px;
  background: var(--bg3);
}
.code-heading {
  min-height: 38px;
  padding: 6px 8px 6px 14px;
  background: var(--bg);
}
.code-block pre {
  padding: 15px 16px;
  background: var(--bg3);
  font-size: 12px;
  line-height: 1.65;
}
.msg-body blockquote {
  margin-block: 10px;
  padding: 8px 14px;
  border-left-color: var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--bg);
}
.message-image {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg3);
}
.msg-body .message-image-link {
  width: fit-content;
  max-width: min(100%, 560px);
  margin: 8px 0 3px;
  line-height: 0;
}
.msg-body .message-image {
  max-width: 100%;
  max-height: min(58dvh, 480px);
  object-fit: contain;
}
.message-image-source.embedded-image-source {
  display: none;
}
.message-gif-link {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}
.message-gif-link::before {
  content: "GIF";
  position: absolute;
  z-index: 1;
  right: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: rgba(12, 16, 22, 0.72);
  color: #fff;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.06em;
  line-height: 1.2;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
[data-animated-media="false"] .message-image.animated-image {
  visibility: hidden;
}
[data-animated-media="false"] .message-image-link:has(.message-image.animated-image)::after {
  content: "Animated image paused";
  display: grid;
  min-height: 112px;
  padding: 18px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
[data-animated-media="false"] .message-gif-link::before {
  display: none;
}
.embed {
  overflow: hidden;
  border-radius: 11px;
  box-shadow: var(--shadow-xs);
}
.link-embed-wrap {
  width: min(520px, 100%);
  margin-block: 10px 2px;
}
.link-embed {
  border-radius: 12px;
  border-left-color: color-mix(in srgb, var(--accent), var(--text) 12%);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.link-embed:hover {
  border-color: var(--line2);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.link-embed-thumb {
  width: 100%;
  max-height: 236px;
  min-height: 92px;
  margin: 0 0 6px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--bg3);
}
.link-embed-favicon {
  display: inline-grid;
  width: 15px;
  height: 15px;
  margin-right: 6px;
  place-items: center;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent), transparent 86%);
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  vertical-align: -2px;
}
.link-embed.embed-loading {
  min-height: 92px;
  cursor: wait;
}
.link-embed-ghost {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--hover) 25%, var(--bg3) 50%, var(--hover) 75%);
  background-size: 200% 100%;
  animation: pw-shimmer 1.15s linear infinite;
}
.link-embed-ghost + .link-embed-ghost {
  margin-top: 9px;
}
.link-embed-ghost.line-2 {
  width: 62%;
}
.link-embed-ghost.line-3 {
  width: 84%;
}
@keyframes pw-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
.link-video {
  width: min(520px, 100%);
  margin-block: 10px 2px;
}
.link-video-frame {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line2);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bg3), var(--bg));
  color: var(--text2);
  box-shadow: var(--shadow-sm);
}
.link-video-thumb {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease, filter 0.3s ease;
}
.link-video:hover .link-video-thumb {
  transform: scale(1.02);
  filter: brightness(0.95);
}
.link-video-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 55%);
}
.link-video-play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.link-video-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 17px 10px 12px;
  border-radius: 999px;
  background: rgba(8, 10, 14, 0.58);
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
  font: 600 14px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, transform 0.15s ease;
}
.link-video:hover .link-video-chip,
.link-video-play:focus-visible .link-video-chip {
  background: var(--action-hover);
  transform: translateY(-1px);
}
.link-video-ico {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #0b0d10;
}
.link-video-ico svg {
  width: 11px;
  height: 12px;
  fill: currentColor;
  transform: translateX(1px);
}
.link-video-play:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.link-video-frame iframe {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.link-video-open {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 620;
}
.link-video-open:hover {
  color: var(--accent);
}
@media (max-width: 620px) {
  .link-embed-thumb {
    max-height: 180px;
  }
  .link-video-chip {
    padding-block: 9px;
    font-size: 13px;
  }
}
.composer {
  position: relative;
  width: min(980px, calc(100% - 48px));
  margin: 8px auto 22px;
  padding: 0;
  overflow: visible;
  z-index: 9;
  border: 1px solid var(--line2);
  border-radius: 14px;
  background: var(--bg2);
  box-shadow: var(--float-shadow);
}
.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 84%), 0 8px 24px rgba(16, 24, 40, 0.08);
}
.composer textarea,
.composer textarea:focus {
  min-height: 66px;
  max-height: min(220px, 32dvh);
  padding: 15px 16px 9px;
  border: 0;
  border-radius: 14px 14px 0 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text1);
  font-size: calc(14px * var(--ui-font-scale));
  line-height: 1.55;
  resize: none;
}
.composer-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 50px;
  padding: 7px 9px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 14px 14px;
  background: color-mix(in srgb, var(--bg), var(--bg2) 45%);
}
.composer-action {
  min-height: 36px;
  height: 36px;
  border-radius: 9px;
  font-size: 12px;
}
.composer .attach-btn {
  padding-inline: 9px;
  border-color: transparent;
  background: transparent;
  color: var(--text2);
}
.composer .attach-btn:hover {
  border-color: var(--line);
}
.compose-format-help summary {
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 9px;
}
.composer-count {
  margin-left: auto;
}
.composer-hint {
  color: var(--muted);
  font-size: 10px;
}
.composer-send {
  min-width: 76px;
  margin-left: 4px;
}
.reply-bar {
  margin: 0;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  background: var(--bg);
}
.compose-format-panel {
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.jump-latest {
  right: max(22px, calc((100% - 980px) / 2 + 10px));
  min-height: 40px;
  padding: 9px 15px;
  border-color: var(--line2);
  border-radius: 999px;
  background: var(--bg2);
  color: var(--text1);
  box-shadow: var(--shadow-md);
  font-weight: 650;
}
.chat-empty {
  min-height: 70%;
  border: 0;
  background: transparent;
  font-style: normal;
}
.pw-mention-picker {
  display: contents;
}
.mention-panel {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  overflow: hidden;
  border: 1px solid var(--line2);
  border-radius: 14px;
  background: var(--bg2);
  box-shadow: var(--shadow-lg);
  color: var(--text1);
  font-size: 13px;
  text-align: left;
}
.mention-panel[hidden] {
  display: none;
}
.mention-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 7px 12px 6px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg), var(--bg2) 45%);
}
.mention-panel-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mention-panel-close {
  display: grid;
  width: 26px;
  height: 26px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}
.mention-panel-close:hover {
  background: var(--hover);
  color: var(--text1);
}
.mention-options {
  max-height: min(40dvh, 320px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
}
.mention-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text1);
  text-align: left;
  cursor: pointer;
}
.mention-option.selected,
.mention-option:hover {
  background: var(--active);
}
.mention-option.selected {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent), transparent 70%);
}
.mention-option-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent), #fff 30%), color-mix(in srgb, var(--accent), transparent 40%)), var(--bg);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}
.mention-option-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mention-option-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.3;
}
.mention-option-name {
  overflow: hidden;
  font-weight: 660;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mention-option-username {
  color: var(--muted);
  font-size: 11px;
}
.mention-panel-foot {
  padding: 6px 14px 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}
.mention {
  display: inline;
  padding: 1px 5px 2px;
  border-radius: 6px;
  border: 0;
  background: var(--pw-mention-bg, color-mix(in srgb, var(--accent), transparent 86%));
  color: var(--accent);
  font: inherit;
  font-weight: 650;
  line-height: inherit;
  vertical-align: baseline;
  white-space: nowrap;
  cursor: pointer;
}
.mention:hover,
.mention:focus-visible {
  background: var(--pw-mention-self-bg, color-mix(in srgb, var(--accent), transparent 76%));
  color: var(--text1);
}
.mention-unresolved {
  opacity: 0.68;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.mention-self {
  background: var(--pw-mention-self-bg, color-mix(in srgb, var(--accent), transparent 76%));
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--pw-mention-ring, color-mix(in srgb, var(--accent), transparent 55%));
}
.mention-chip {
  margin-left: 6px;
  border-color: color-mix(in srgb, var(--accent), transparent 55%);
  background: color-mix(in srgb, var(--accent), transparent 85%);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  vertical-align: 1px;
}
@media (max-width: 620px) {
  .mention-panel {
    border-radius: 12px;
  }
  .mention-options {
    max-height: min(44dvh, 300px);
  }
}
.group-members {
  border-radius: 0;
  border-width: 0 0 0 1px;
  background: var(--bg);
}
.group-members-head {
  min-height: 70px;
  padding: 17px 16px 12px;
  background: var(--bg2);
}
.group-member {
  min-height: 54px;
  padding: 8px 9px;
  border-radius: 10px;
}
.group-member:hover {
  background: var(--hover);
}
.settings-page {
  height: 100%;
  border: 0;
  border-radius: 0;
  background: var(--bg2);
  box-shadow: none;
}
.settings-sidebar {
  width: 210px;
  min-width: 210px;
  padding: 28px 10px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}
.settings-nav-label {
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
}
.settings-tab {
  min-height: 42px;
  margin: 2px 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text2);
  font-size: 12px;
}
.settings-tab:hover {
  background: var(--hover);
  color: var(--text1);
  transform: none;
}
.settings-tab.active {
  border-left-color: transparent;
  background: var(--active);
  color: var(--text1);
  font-weight: 680;
}
.settings-content {
  padding: 0;
  background: var(--bg2);
}
.settings-content-top {
  min-height: 104px;
  padding: 27px clamp(28px, 4vw, 44px) 22px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
}
.settings-content-top h1 {
  margin: 3px 0 0;
  color: var(--text1);
  font-size: 27px;
  font-weight: 680;
  letter-spacing: -0.04em;
}
.settings-user-chip {
  padding: 6px 10px 6px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
}
.settings-search {
  padding: 22px clamp(28px, 4vw, 44px) 0;
}
.settings-search input {
  width: min(820px, 100%);
  min-height: 44px;
  background: var(--bg);
}
.settings-content-inner {
  padding: 26px clamp(28px, 4vw, 44px) 48px;
}
.settings-card {
  width: min(820px, 100%);
  overflow: hidden;
  border-radius: var(--card-radius);
  background: var(--bg2);
  box-shadow: var(--shadow-xs);
}
.settings-card-head {
  padding: 25px 26px 19px;
  border-bottom: 1px solid var(--line);
}
.settings-card-head h2 {
  margin: 0;
  color: var(--text1);
  font-size: 19px;
  font-weight: 680;
  letter-spacing: -0.02em;
}
.settings-card-head p {
  max-width: 58ch;
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.55;
}
.settings-panel {
  padding: 0 26px 8px;
}
.setting-row {
  min-width: 0;
  min-height: 82px;
  gap: 22px;
  padding: 18px 0;
}
.setting-row b {
  color: var(--text1);
  font-size: 13px;
  font-weight: 650;
}
.setting-row small {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.55;
}
.setting-icon {
  border-radius: 11px;
}
.settings-switch {
  box-shadow: inset 0 0 0 1px var(--line2);
}
.settings-action-card,
.choice-card,
.voice-mode-button {
  border-radius: 11px;
  box-shadow: none;
}
.settings-action-card:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}
.profile-settings-card .settings-banner {
  min-height: 140px;
  padding: 27px;
  background: var(--bg);
}
.profile-settings-card .settings-avatar-wrap .avatar {
  width: 68px;
  height: 68px;
  border-radius: 20px;
}
.profile-settings-card .settings-fields {
  gap: 22px;
  padding: 26px;
}
.settings-fields > .nav-actions {
  bottom: -48px;
  padding: 18px 0;
  background: var(--bg2);
}
.settings-sidebar {
  display: flex;
  flex-direction: column;
  width: 232px;
  min-width: 232px;
  padding: 24px 12px 16px;
}
.settings-sidebar .settings-nav-label {
  padding: 0 12px 12px;
}
.settings-sidebar .settings-nav-separator {
  margin-block: 8px;
}
.settings-tab {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 7px 9px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  box-shadow: var(--shadow-xs);
  box-shadow: none;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.settings-tab .settings-tab-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 7px;
  border-radius: 10px;
}
.settings-tab .settings-tab-icon > .ui-icon,
.settings-tab .settings-tab-icon > .call-icon {
  width: 16px;
  height: 16px;
  min-width: 16px;
  color: inherit;
}
.settings-tab .settings-tab-copy {
  min-width: 0;
}
.settings-tab .settings-tab-copy b,
.settings-tab .settings-tab-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-tab .settings-tab-copy b {
  color: inherit;
  font-size: 12px;
  font-weight: 680;
}
.settings-tab .settings-tab-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 520;
}
.settings-tab:hover {
  border-color: var(--line);
  background: var(--hover-soft);
}
.settings-tab.active {
  border-color: color-mix(in srgb, var(--accent), transparent 68%);
  background: color-mix(in srgb, var(--accent), transparent 90%);
  box-shadow: inset 3px 0 0 var(--accent);
}
.settings-tab.active .settings-tab-copy small {
  color: var(--text2);
}
.settings-tab[data-setting="profile"] .settings-tab-icon {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 89%);
}
.settings-tab[data-setting="appearance"] .settings-tab-icon {
  color: #a46fd1;
  background: color-mix(in srgb, #a46fd1, transparent 89%);
}
.settings-tab[data-setting="chat"] .settings-tab-icon {
  color: #3d91c8;
  background: color-mix(in srgb, #3d91c8, transparent 89%);
}
.settings-tab[data-setting="voice"] .settings-tab-icon {
  color: #3ca071;
  background: color-mix(in srgb, #3ca071, transparent 89%);
}
.settings-tab[data-setting="sound"] .settings-tab-icon {
  color: #c78a32;
  background: color-mix(in srgb, #c78a32, transparent 89%);
}
.settings-tab[data-setting="privacy"] .settings-tab-icon {
  color: #b85d72;
  background: color-mix(in srgb, #b85d72, transparent 89%);
}
.settings-tab[data-setting="account"] .settings-tab-icon {
  color: var(--text2);
  background: color-mix(in srgb, var(--text2), transparent 89%);
}
.settings-nav-footer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: auto 8px 0;
  padding: 13px 10px 2px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.settings-nav-footer b,
.settings-nav-footer small {
  display: block;
}
.settings-nav-footer b {
  color: var(--text2);
  font-size: 10px;
  font-weight: 650;
}
.settings-nav-footer small {
  margin-top: 2px;
  font-size: 9px;
  line-height: 1.4;
}
.settings-saved-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok), transparent 86%);
}
.settings-heading {
  min-width: 0;
}
.settings-subtitle {
  max-width: 64ch;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.settings-search {
  position: sticky;
  top: 0;
  z-index: 5;
  padding-bottom: 10px;
  background: linear-gradient(var(--bg2) 78%, transparent);
}
.settings-search-field {
  position: relative;
  width: min(820px, 100%);
}
.settings-search-field > .ui-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}
.settings-search-field input {
  width: 100%;
  padding-inline: 42px 68px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--shadow-xs);
}
.settings-search-field input:focus {
  border-color: color-mix(in srgb, var(--accent), var(--line) 38%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 88%);
}
.settings-search-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  min-height: 28px;
  padding: 3px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  transform: translateY(-50%);
  cursor: pointer;
}
.settings-search-clear:hover {
  background: var(--hover);
  color: var(--text1);
}
.settings-search-results {
  width: min(820px, 100%);
}
.settings-search-results button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: var(--shadow-xs);
  box-shadow: none;
}
.settings-card {
  border-color: color-mix(in srgb, var(--line), var(--text2) 5%);
}
.settings-card-head {
  background: linear-gradient(110deg, color-mix(in srgb, var(--accent), transparent 96%), transparent 62%);
}
.settings-panel .setting-row:last-child {
  border-bottom: 0;
}
.segmented-control .btn[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent), var(--line) 35%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent), transparent 90%);
}
.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.field-label-row label {
  margin: 0;
}
.field-label-row .field-count {
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}
.voice-settings > .settings-screen-share-control {
  display: block;
  margin: 20px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--shadow-xs);
  box-shadow: none;
}
.voice-settings > .settings-screen-share-control summary {
  min-height: 48px;
  padding: 14px 15px;
  color: var(--text1);
}
.voice-settings > .settings-screen-share-control details[open] summary {
  border-bottom: 1px solid var(--line);
}
.forum-directory-hero,
.server-hero {
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: color-mix(in srgb, var(--bg2), var(--accent) 3%);
  box-shadow: var(--shadow-xs);
}
.forum-directory-hero h2,
.server-hero-copy h1 {
  color: var(--text1);
  letter-spacing: -0.04em;
}
.forum-grid {
  gap: 14px;
}
.forum-card {
  border-radius: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.forum-card:hover {
  border-color: color-mix(in srgb, var(--accent), var(--line) 55%);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.forum-card-top {
  padding: 18px 18px 11px;
}
.forum-card-footer {
  padding: 11px 18px;
  background: var(--bg);
}
.friends-page,
.notifications-page {
  overflow: hidden;
}
.friends-toolbar {
  padding: 16px 18px;
}
.friends-content {
  padding: 20px;
  background: var(--bg);
}
.friends-list,
.notifications-list {
  padding: 7px;
}
.friends-list .friend-row,
.notifications-list .notif {
  min-height: 68px;
  padding: 11px 13px;
  border-radius: 10px;
}
.add-friend-form {
  border-radius: 12px;
  background: var(--bg2);
  box-shadow: var(--shadow-xs);
}
.notifications-list .notif.unseen {
  background: var(--active);
}
.notifications-list .notification-row.is-mention {
  background: color-mix(in srgb, var(--accent), transparent 93%);
}
.notifications-list .notification-row.is-mention .notification-title-row b {
  color: var(--accent);
}
.server-welcome {
  padding: 26px;
  border-radius: 12px;
  background: var(--bg);
}
.server-hero {
  min-height: 220px;
}
.server-hero-actions {
  gap: 9px;
}
.people-options {
  padding: 5px;
  border-radius: 11px;
  background: var(--bg);
}
.people-option {
  min-height: 66px;
  padding: 10px 12px;
  border-radius: 9px;
}
.person-chip {
  min-height: 36px;
  border-radius: 8px;
}
.server-identity-preview {
  border-radius: 13px;
}
.server-customize-preview {
  border-radius: 10px;
}
.accent-swatch {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-radius: 10px;
}
.call-overlay.expanded,
.call-bar,
.pw-float {
  border-color: var(--line);
  border-radius: 14px;
  background: var(--bg2);
  box-shadow: var(--shadow-md);
}
.call-user-row,
.call-input-panel,
.call-health,
pw-screen-settings {
  border-radius: 11px;
  background: var(--bg);
}
.call-control {
  border-radius: 11px;
}
.voice-card {
  border-radius: var(--card-radius);
}
.voice-participant {
  border-radius: 11px;
}
.auth-shell {
  background: var(--bg2);
}
.auth-brand-panel {
  padding: clamp(44px, 6vw, 84px);
  border-right: 1px solid var(--line);
  background: var(--bg3);
}
.auth-brand-panel::after {
  display: none;
}
.auth-brand-lockup {
  color: var(--text1);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.035em;
}
.auth-brand-mark {
  position: relative;
  border-radius: 11px;
  background: var(--text1);
  box-shadow: var(--shadow-sm);
}
.auth-brand-mark::after {
  content: none;
  display: none;
}
.auth-brand-copy {
  max-width: 620px;
}
.auth-brand-copy h1 {
  max-width: 10ch;
  margin: 18px 0 22px;
  color: var(--text1);
  font-size: clamp(48px, 5.5vw, 76px);
  font-weight: 650;
  line-height: 1.01;
  letter-spacing: -0.065em;
}
.auth-brand-copy > p {
  max-width: 40ch;
  color: var(--text2);
  font-size: 15px;
  line-height: 1.7;
}
.auth-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line2);
}
.auth-capabilities span {
  color: var(--text2);
  font-size: 11px;
  font-weight: 600;
}
.auth-form-panel {
  padding: clamp(34px, 6vw, 76px);
  background: var(--bg2);
}
.auth-form-wrap {
  width: min(400px, 100%);
}
.auth-heading {
  margin-bottom: 24px;
}
.auth-heading h2 {
  margin: 0 0 7px;
  color: var(--text1);
  font-size: 30px;
  font-weight: 680;
  letter-spacing: -0.045em;
}
.auth-heading p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}
.auth-mode-switch {
  margin-bottom: 24px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
}
.auth-mode-btn {
  min-height: 38px;
  border-radius: 8px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 650;
}
.auth-mode-btn.active {
  background: var(--bg2);
  color: var(--text1);
  box-shadow: var(--shadow-xs);
}
.auth-fields {
  gap: 17px;
}
.auth-fields input {
  min-height: 46px;
  border-radius: 10px;
}
.auth-submit {
  min-height: 46px;
  margin-top: 3px;
  border-radius: 10px;
}
.auth-footnote {
  margin-top: 22px;
  font-size: 11px;
}
.auth-instance-meta {
  margin-top: 24px;
  color: var(--muted);
  font-size: 10px;
}
@media (max-width: 1100px) and (min-width: 761px) {
  .home-columns {
    grid-template-columns: 1fr;
  }
  .home-activity {
    min-height: 250px;
  }
  .settings-sidebar {
    width: 176px;
    min-width: 176px;
  }
  .settings-tab {
    grid-template-columns: 28px minmax(0, 1fr);
    min-height: 48px;
  }
  .settings-tab .settings-tab-icon {
    width: 28px;
    height: 28px;
    padding: 6px;
  }
  .settings-tab .settings-tab-copy small,
  .settings-nav-footer small {
    display: none;
  }
  .settings-user-chip {
    display: none;
  }
  .profile-settings-card .settings-fields {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .home-welcome {
    align-items: flex-start;
    flex-direction: column;
    gap: 22px;
    min-height: 0;
    padding: 24px 20px;
  }
  .home-welcome-copy h1 {
    font-size: 30px;
  }
  .home-primary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .home-primary-actions .btn {
    min-width: 0;
    padding-inline: 10px;
  }
  .home-stat-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-block: 12px 20px;
  }
  .home-stat-grid .stat-card {
    min-height: 76px;
    padding: 14px 16px;
  }
  .home-stat-grid .stat-value {
    min-width: 32px;
    font-size: 24px;
  }
  .home-columns {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .home-panel {
    padding: 18px !important;
  }
  .home-recent-list .dm-row {
    min-height: 70px;
    padding-inline: 4px;
  }
  .home-quick-links {
    grid-template-columns: 1fr 1fr;
  }
  .chat-header {
    height: auto;
    min-height: calc(64px + env(safe-area-inset-top));
    padding: calc(8px + env(safe-area-inset-top)) 11px 8px;
    gap: 9px;
  }
  .chat-header .avatar {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }
  .chat-header h2 {
    font-size: 14px;
  }
  .chat-header .grow small {
    max-width: 38vw;
  }
  .chat-header .btn {
    min-height: 42px;
  }
  .chat-header .group-add-button {
    width: 42px;
    min-width: 42px;
    padding: 0;
  }
  .messages {
    padding: 10px 8px 18px;
  }
  .msg {
    gap: 10px;
    padding: 10px 6px;
  }
  .msg.compact {
    padding-block: 4px;
  }
  .msg > .avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 10px;
  }
  .msg-body {
    font-size: 14px;
    line-height: 1.58;
  }
  .message-date {
    margin-block: 18px 12px;
  }
  .msg-actions {
    right: 5px;
  }
  .code-block pre {
    max-height: 42dvh;
    padding: 13px;
  }
  .composer {
    width: calc(100% - 20px);
    margin: 5px 10px max(10px, env(safe-area-inset-bottom));
    border-radius: 12px;
  }
  .composer textarea,
  .composer textarea:focus {
    min-height: 56px;
    max-height: min(112px, 22dvh);
    padding: 13px 13px 7px;
    border-radius: 12px 12px 0 0;
    font-size: 16px;
    overscroll-behavior: contain;
  }
  .composer-footer {
    min-height: 52px;
    padding: 5px 7px;
    border-radius: 0 0 12px 12px;
  }
  .composer-action {
    width: 42px;
    min-width: 42px !important;
    height: 42px;
    min-height: 42px;
    padding: 0 !important;
  }
  .composer .attach-btn .composer-action-label,
  .composer-hint {
    display: none;
  }
  .composer-count {
    margin-left: auto;
  }
  .composer-send.composer-action {
    width: auto;
    min-width: 72px !important;
    padding-inline: 10px !important;
  }
  .call-event {
    grid-template-areas: "icon copy" "action action";
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    width: calc(100% - 8px);
    min-height: 0;
    gap: 10px;
    padding: 11px;
  }
  .call-event-icon {
    grid-area: icon;
  }
  .call-event-copy {
    grid-area: copy;
  }
  .call-event-action {
    position: static;
    grid-area: action;
    width: 100%;
    min-height: 38px;
    margin: 0;
    justify-content: center;
  }
  .jump-latest {
    right: 16px;
    min-height: 42px;
  }
  .format-tools button {
    min-height: 40px;
  }
  .compose-format-panel {
    max-height: min(420px, 64dvh);
  }
  .group-members {
    order: -1;
    border-width: 0 0 1px;
  }
  .group-members-head {
    min-height: 58px;
  }
  .settings-page {
    overflow: hidden;
  }
  .settings-sidebar {
    display: none;
  }
  .settings-mobile-nav {
    flex-shrink: 0;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
  }
  .settings-mobile-tab {
    min-height: 42px;
    padding-inline: 14px;
    border-radius: 9px;
  }
  .settings-content-top {
    min-height: 88px;
    padding: 22px 18px 17px;
  }
  .settings-content-top h1 {
    font-size: 25px;
  }
  .settings-subtitle {
    display: none;
  }
  .settings-search {
    padding: 15px 16px 0;
  }
  .settings-content-inner {
    padding: 18px 14px 32px;
  }
  .settings-card {
    margin: 0;
    width: 100%;
    border-radius: 13px;
  }
  .settings-card-head {
    padding: 21px 19px 17px;
  }
  .settings-panel {
    padding-inline: 19px;
  }
  .setting-row {
    align-items: flex-start;
    gap: 14px;
    padding-block: 18px;
  }
  .setting-row:not(.setting-row-stack) {
    align-items: center;
  }
  .profile-settings-card .settings-banner {
    min-height: 126px;
    padding: 20px;
  }
  .profile-settings-card .settings-fields {
    grid-template-columns: 1fr;
    gap: 19px;
    padding: 20px;
  }
  .settings-fields > .nav-actions {
    bottom: -32px;
  }
  .voice-settings > .settings-screen-share-control {
    margin-inline: 0;
  }
  .field input,
  .field textarea,
  .field select,
  .settings-search input,
  .people-search {
    font-size: 16px;
  }
  .forum-directory-hero,
  .server-hero {
    padding: 22px 19px;
    border-radius: 13px;
  }
  .server-hero {
    gap: 22px;
    min-height: 0;
  }
  .server-hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .server-hero-actions .btn:first-child {
    grid-column: 1 / -1;
  }
  .forum-grid {
    grid-template-columns: 1fr;
  }
  .friends-content {
    padding: 16px;
  }
  .modal {
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }
  .modal-card,
  .action-modal {
    width: 100%;
    max-height: min(94dvh, calc(var(--pw-visual-height, 100dvh) - 20px));
    border-radius: 0px;
  }
  .modal-card .modal-head {
    padding: 20px 19px 17px;
  }
  .modal-card .modal-body {
    padding: 20px 19px;
  }
  .modal-card .modal-actions {
    padding: 13px 19px;
  }
  .modal-card .modal-actions .btn {
    min-height: 44px;
  }
  .people-options {
    max-height: min(240px, 34dvh);
  }
  .people-option {
    min-height: 64px;
  }
  .pw-float {
    top: max(76px, env(safe-area-inset-top)) !important;
    height: min(30dvh, 240px) !important;
    min-height: 160px;
  }
  .auth-shell {
    min-height: 100dvh;
    overflow-y: auto;
  }
  .auth-brand-panel {
    display: none;
  }
  .auth-form-panel {
    min-height: 100dvh;
    padding: max(34px, env(safe-area-inset-top)) 22px max(32px, env(safe-area-inset-bottom));
  }
  .auth-mobile-brand {
    margin-bottom: 32px;
  }
  .auth-heading h2 {
    font-size: 29px;
  }
  .auth-mode-btn {
    min-height: 42px;
  }
  .auth-fields input,
  .auth-submit {
    min-height: 48px;
  }
}
@media (max-width: 390px) {
  .content {
    padding-inline: 12px;
  }
  .home-welcome {
    padding-inline: 17px;
  }
  .home-primary-actions {
    grid-template-columns: 1fr;
  }
  .home-panel {
    padding: 16px !important;
  }
  .settings-content-inner {
    padding-inline: 10px;
  }
  .settings-card-head,
  .settings-panel {
    padding-inline: 16px;
  }
  .chat-header .chat-call-label {
    display: none;
  }
  .chat-header .chat-call-action {
    width: 42px;
    min-width: 42px;
    padding: 0;
  }
}
@media (max-width: 760px) and (orientation: landscape) and (max-height: 500px) {
  .auth-form-panel {
    padding-top: 18px;
  }
  .auth-mobile-brand {
    margin-bottom: 18px;
  }
  .modal-card,
  .action-modal {
    max-height: 96dvh;
  }
}
/* 1.7.5-2: server identity + message reactions stay inside Plainwire's
   existing compact workspace language instead of introducing card-heavy UI. */
.message-reactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}
.message-reaction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 38px;
  min-height: 28px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg2);
  color: var(--text2);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.message-reaction:hover {
  border-color: var(--line2);
  background: var(--hover-soft);
  color: var(--text1);
}
.message-reaction.mine {
  border-color: color-mix(in srgb, var(--accent), var(--line) 55%);
  background: color-mix(in srgb, var(--accent), transparent 91%);
  color: var(--text1);
}
.message-reaction-emoji {
  font-size: 15px;
  line-height: 1;
}
.message-reaction-count {
  min-width: 1ch;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.server-profile-loading {
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
}
.server-profile-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.server-profile-copy {
  min-width: 0;
}
.server-profile-copy h2 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 21px;
  letter-spacing: -0.025em;
}
.server-profile-copy p {
  margin: 4px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-profile-about,
.server-profile-roles {
  margin-top: 18px;
}
.server-profile-about p {
  margin: 7px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.server-profile-role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}
.server-profile-role {
  --role-color: var(--text2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--role-color), var(--line) 68%);
  border-radius: 7px;
  background: color-mix(in srgb, var(--role-color), transparent 93%);
  color: var(--text1);
  font-size: 12px;
  font-weight: 650;
}
.server-profile-role-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--role-color);
}
.server-profile-role.legacy {
  --role-color: var(--accent);
}
.server-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.danger-confirm {
  display: grid;
  gap: 13px;
}
.delete-server-name {
  width: fit-content;
  max-width: 100%;
  padding: 7px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--danger), var(--line) 62%);
  border-radius: 7px;
  background: color-mix(in srgb, var(--danger), transparent 94%);
  color: var(--text1);
  font-weight: 700;
}
/* The GIF badge already says GIF. Repeating a second text label beside it was
   what collided at compact widths. Keep one semantic button label via aria-label
   and one visible badge, then let the action retain a fixed touch target. */
.composer .gif-action .composer-action-label {
  display: none;
}
.composer .gif-action {
  flex: 0 0 auto;
  overflow: hidden;
  white-space: nowrap;
}
.composer .gif-action .composer-action-gif {
  flex: 0 0 auto;
}
@media (max-width: 760px) {
  .composer .gif-action .composer-action-label {
    display: none;
  }
  .server-profile-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .server-profile-actions .btn:first-child {
    grid-column: 1 / -1;
  }
  .message-reaction {
    min-height: 30px;
  }
}
.server-danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid color-mix(in srgb, var(--danger), var(--line) 68%);
}
.server-danger-zone .setting-copy {
  min-width: 0;
}
.server-danger-zone .setting-copy small {
  display: block;
  margin-top: 4px;
}
.server-danger-zone .btn {
  flex: 0 0 auto;
}
@media (max-width: 520px) {
  .server-danger-zone {
    align-items: stretch;
    flex-direction: column;
  }
  .server-danger-zone .btn {
    width: 100%;
  }
}
/* First-party Wire invites get a richer in-chat card than generic URL unfurls. */
.wire-embed {
  padding: 0;
  overflow: hidden;
  border-left: 3px solid var(--wire-accent, var(--accent));
  cursor: default;
}
.wire-embed:hover {
  transform: none;
}
.wire-embed-banner {
  display: block;
  width: 100%;
  height: 104px;
  object-fit: cover;
  background: var(--bg3);
}
.wire-embed-body {
  padding: 13px 14px 14px;
}
.wire-embed-identity {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}
.wire-embed-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 14px;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--bg3);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 20px;
}
.wire-embed-identity > div {
  min-width: 0;
}
.wire-embed-identity small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 3px;
}
.wire-embed-identity strong {
  display: block;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.wire-embed-identity p {
  margin: 5px 0 0;
  color: var(--text2);
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wire-embed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 11px;
}
.wire-embed-actions {
  display: flex;
  margin-top: 12px;
}
.wire-embed-actions .btn {
  text-decoration: none;
}
/* Theme-facing presentation hooks.
   These stay in Less on purpose: client/theme authors can override this compact
   token layer without having to understand component SCSS. */
:root,
[data-theme="light"],
[data-theme="dark"] {
  --pw-mention-bg: color-mix(in srgb, var(--accent), transparent 86%);
  --pw-mention-self-bg: color-mix(in srgb, var(--accent), transparent 76%);
  --pw-mention-ring: color-mix(in srgb, var(--accent), transparent 55%);
  --pw-forward-surface: color-mix(in srgb, var(--bg2), var(--accent) 4%);
  --pw-forward-border: color-mix(in srgb, var(--line), var(--accent) 18%);
  --pw-key-surface: color-mix(in srgb, var(--bg3), var(--accent) 8%);
  --pw-emoji-surface: color-mix(in srgb, var(--bg2), var(--accent) 6%);
  --pw-emoji-hover: color-mix(in srgb, var(--bg3), var(--accent) 12%);
  --pw-context-shadow: 0 14px 34px color-mix(in srgb, #000, transparent 82%);
}
/* Plainwire brand mark is intentionally a real image, not a text fallback.
   Keep this override last because legacy component layers still use background
   shorthands for these surfaces. */
.rail .mark,
.auth-brand-mark {
  background-color: #fff;
  background-image: url('/assets/plainwire-mark.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 78%;
  color: transparent;
}
.mark::after,
.auth-brand-mark::after {
  content: none;
  display: none;
}
/* Plainwire Source Hub -------------------------------------------------------
   This page deliberately reuses Plainwire's neutral surfaces, spacing, buttons,
   and type hierarchy instead of introducing a GitHub-themed mini-app. */
.route-source .content {
  padding: 0;
  overflow: auto;
  background: var(--bg);
}
.source-hub-page,
pw-source-hub,
.source-hub {
  display: block;
  min-width: 0;
  min-height: 100%;
}
.source-hub {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: clamp(18px, 2.8vw, 36px);
}
.source-hub :where(h1, h2, h3, p) {
  margin-top: 0;
}
.source-hub h1 {
  margin-bottom: 8px;
  color: var(--text1);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.06;
  letter-spacing: -0.045em;
}
.source-hub h2 {
  margin-bottom: 6px;
  color: var(--text1);
  font-size: clamp(20px, 2.3vw, 27px);
  line-height: 1.15;
  letter-spacing: -0.028em;
}
.source-hub h3 {
  margin-bottom: 5px;
  color: var(--text1);
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: -0.012em;
}
.source-hub p {
  margin-bottom: 0;
}
.source-hero,
.source-repo-hero,
.source-profile-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  padding: clamp(22px, 3vw, 36px);
  border-color: var(--line2);
  background: var(--bg2);
}
.source-hero-copy {
  max-width: 780px;
}
.source-hero-copy > p {
  max-width: 720px;
  font-size: 14px;
  line-height: 1.65;
}
.source-hero-actions,
.source-repo-hero-actions,
.source-profile-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
}
.source-external {
  text-decoration: none;
}
.source-hub .btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}
.source-hub a.btn {
  box-sizing: border-box;
}
.source-live-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--ok), transparent 66%);
  border-radius: var(--control-radius);
  background: color-mix(in srgb, var(--ok), transparent 92%);
  color: var(--ok);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.source-live-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor, transparent 86%);
}
.source-live-chip.is-loading::before {
  animation: source-pulse 1s ease-in-out infinite alternate;
}
.source-live-chip.is-warning {
  border-color: color-mix(in srgb, #d98324, transparent 60%);
  background: color-mix(in srgb, #d98324, transparent 91%);
  color: color-mix(in srgb, #d98324, var(--text1) 22%);
}
@keyframes source-pulse {
  to {
    opacity: 0.35;
    transform: scale(0.75);
  }
}
.source-landing,
.source-repository-page,
.source-profile-page {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}
.source-summary {
  display: block;
}
.source-org-card {
  padding: 20px 22px;
}
.source-org-top {
  display: flex;
  align-items: center;
  gap: 13px;
}
.source-org-mark {
  width: 48px;
  height: 48px;
  display: grid;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 15px;
  background: #fff url('/assets/plainwire-mark.svg') center / 76% no-repeat;
  border: 1px solid var(--line);
  color: transparent;
  box-shadow: var(--shadow-xs);
}
.source-org-copy h2 {
  margin: 0 0 2px;
  font-size: 19px;
}
.source-org-copy p {
  font-size: 12px;
}
.source-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 8px;
  margin-top: 18px;
}
.source-stat {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--bg), var(--bg2) 48%);
}
.source-stat strong {
  display: block;
  overflow: hidden;
  color: var(--text1);
  font-size: 17px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}
.source-workspace {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  background: var(--bg2);
  box-shadow: var(--shadow-xs);
}
.source-tabs {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  padding: 7px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg), var(--bg2) 56%);
  scrollbar-width: thin;
}
.source-tab {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
  cursor: pointer;
}
.source-tab:hover {
  background: var(--hover);
  color: var(--text1);
}
.source-tab.active {
  background: var(--bg2);
  color: var(--text1);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-xs);
}
.source-panel {
  min-width: 0;
  padding: clamp(18px, 2.6vw, 28px);
}
.source-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.source-section-head > div:first-child {
  min-width: 0;
}
.source-section-head p {
  max-width: 760px;
  font-size: 12px;
  line-height: 1.55;
}
.source-search {
  width: min(320px, 100%);
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line2);
  border-radius: var(--control-radius);
  background: var(--bg2);
  color: var(--text1);
  box-shadow: var(--shadow-xs);
}
.source-search:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 82%);
}
.source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 74%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent), transparent 92%);
  color: var(--text2);
  font-size: 10px;
  font-weight: 690;
  line-height: 1;
  white-space: nowrap;
}
.source-pill.subtle {
  border-color: var(--line);
  background: var(--bg);
  color: var(--muted);
}
.source-pill.warning {
  border-color: color-mix(in srgb, #d98324, transparent 62%);
  background: color-mix(in srgb, #d98324, transparent 91%);
  color: color-mix(in srgb, #d98324, var(--text1) 25%);
}
.source-topic-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}
.source-activity-list,
.source-commit-list,
.source-file-list {
  display: grid;
}
.source-activity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.38fr);
  gap: 16px;
  align-items: start;
}
.source-active-contributors {
  position: sticky;
  top: 12px;
  overflow: hidden;
  padding: 15px;
}
.source-active-contributors > h3 {
  margin-top: 3px;
  margin-bottom: 10px;
}
.source-active-contributor-list {
  display: grid;
  margin-inline: -5px;
}
.source-active-contributor {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 5px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.source-active-contributor:last-child {
  border-bottom: 0;
}
.source-active-contributor:hover,
.source-active-contributor:focus-visible {
  background: var(--hover);
  outline: 0;
}
.source-active-contributor.is-anonymous {
  cursor: default;
}
.source-active-contributor.is-anonymous:hover {
  background: transparent;
}
.source-active-contributor-copy {
  min-width: 0;
}
.source-active-contributor-copy strong,
.source-active-contributor-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-active-contributor-copy strong {
  color: var(--text1);
  font-size: 11px;
}
.source-active-contributor-copy small {
  margin-top: 2px;
  font-size: 9px;
}
.source-active-note {
  margin-top: 10px;
  font-size: 9px;
  line-height: 1.45;
}
.source-event-commit-button {
  display: block;
  width: 100%;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.source-event-commit-button:hover,
.source-event-commit-button:focus-visible {
  color: var(--action);
  text-decoration: underline;
  text-underline-offset: 2px;
  outline: 0;
}
.source-activity-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
}
.source-activity-row:last-child {
  border-bottom: 0;
}
.source-activity-copy {
  min-width: 0;
}
.source-activity-line {
  color: var(--text1);
  font-size: 13px;
  line-height: 1.5;
}
.source-activity-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}
.source-event-commits {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--bg);
  color: var(--muted);
  font: 10px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.source-event-detail {
  margin-top: 7px;
  font-size: 11px;
}
.source-inline-button {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--action);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.source-inline-button:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.source-activity-actor {
  color: var(--text1);
  font-weight: 700;
}
.source-inline-link {
  color: var(--action);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.source-inline-link:hover {
  text-decoration: underline;
}
.source-avatar {
  display: inline-grid;
  overflow: hidden;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg4);
  color: var(--text2);
  font-weight: 750;
  box-shadow: var(--shadow-xs);
}
.source-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.source-avatar-xs {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 9px;
}
.source-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 11px;
}
.source-avatar-md {
  width: 42px;
  height: 42px;
  font-size: 13px;
}
.source-avatar-lg {
  width: 58px;
  height: 58px;
  border-radius: 15px;
  font-size: 17px;
}
.source-avatar-xl {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  font-size: 28px;
}
.source-repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 11px;
}
.source-repo-card {
  display: flex;
  min-width: 0;
  min-height: 220px;
  flex-direction: column;
  padding: 17px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.source-repo-card:hover {
  border-color: var(--line2);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.source-repo-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}
.source-repo-card h3 {
  margin-bottom: 6px;
  font-size: 16px;
}
.source-repo-card p {
  min-height: 40px;
  font-size: 11px;
  line-height: 1.55;
}
.source-repo-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 10px;
}
.source-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
  padding-top: 15px;
}
.source-card-actions .btn {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 11px;
}
.source-architecture-flow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.source-architecture-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--bg2);
}
.source-architecture-index {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 68%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent), transparent 92%);
  color: var(--action);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.source-architecture-copy p {
  margin-top: 8px;
  color: var(--text2);
  font-size: 11px;
  line-height: 1.55;
}
.source-architecture-actions {
  margin-top: 12px;
}
.source-architecture-actions .btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 10px;
}
.source-metadata {
  margin-top: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
}
.source-metadata summary {
  padding: 11px 13px;
  color: var(--text1);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.source-metadata[open] summary {
  border-bottom: 1px solid var(--line);
  background: var(--hover-soft);
}
.source-json {
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  background: var(--bg3);
  color: var(--text2);
  font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.source-back {
  width: fit-content;
  padding: 7px 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}
.source-back:hover {
  color: var(--text1);
}
.source-repo-hero-copy,
.source-profile-copy {
  min-width: 0;
}
.source-repo-hero-copy > p {
  max-width: 760px;
  font-size: 13px;
  line-height: 1.55;
}
.source-repo-stats,
.source-profile-stats {
  grid-column: 1 / -1;
  margin-top: 0;
}
.source-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 0.72fr);
  gap: 14px;
  align-items: start;
}
.source-readme {
  min-width: 0;
  overflow: hidden;
  padding: 0;
}
.source-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.source-card-head h2 {
  margin: 0;
  font-size: 16px;
}
.source-card-head small {
  font-size: 10px;
}
.source-readme > pw-markdown {
  display: block;
  max-height: 860px;
  overflow: auto;
  padding: 18px;
  color: var(--text2);
}
.source-readme > pw-markdown :where(h1,h2,h3,h4) {
  color: var(--text1);
}
.source-readme > pw-markdown h1 {
  font-size: 25px;
}
.source-readme > pw-markdown h2 {
  font-size: 20px;
}
.source-overview-side {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.source-language-card,
.source-facts,
.source-profile-orgs {
  padding: 15px;
}
.source-language-bar {
  display: flex;
  overflow: hidden;
  height: 8px;
  margin: 12px 0;
  border-radius: 999px;
  background: var(--bg4);
}
.source-language-segment {
  min-width: 2px;
  background: var(--accent);
  border-right: 1px solid var(--bg2);
}
.source-language-segment:nth-child(2n) {
  opacity: 0.78;
}
.source-language-segment:nth-child(3n) {
  opacity: 0.58;
}
.source-language-segment:nth-child(4n) {
  opacity: 0.42;
}
.source-language-list {
  display: grid;
  gap: 6px;
}
.source-language-row,
.source-fact-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
}
.source-fact-row {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.source-fact-row:last-child {
  border-bottom: 0;
}
.source-commit-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 13px 8px;
  border-bottom: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.source-commit-row:last-child {
  border-bottom: 0;
}
.source-commit-row:hover,
.source-commit-row:focus-visible {
  background: var(--hover);
  outline: none;
}
.source-commit-copy {
  min-width: 0;
}
.source-commit-message {
  display: block;
  overflow: hidden;
  color: var(--text1);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-commit-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}
.source-sha {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--bg3);
  color: var(--text2);
  font-size: 9px;
}
.source-row-chevron {
  color: var(--muted);
  font-size: 20px;
  font-weight: 300;
}
.source-version-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(240px, 0.7fr);
  gap: 14px;
  align-items: start;
}
.source-release-list {
  display: grid;
  gap: 10px;
}
.source-release-list > h3 {
  margin-bottom: 0;
}
.source-release {
  overflow: hidden;
  padding: 0;
}
.source-release-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px;
}
.source-release-head h3 {
  margin: 0;
  font-size: 15px;
}
.source-release-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 10px;
}
.source-release-body {
  max-height: 360px;
  overflow: auto;
  padding: 14px 15px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.source-release-body pw-markdown {
  font-size: 11px;
}
.source-release-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 15px;
  border-top: 1px solid var(--line);
  font-size: 10px;
}
.source-ref-column {
  display: grid;
  gap: 10px;
}
.source-ref-card {
  padding: 14px;
}
.source-ref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}
.source-ref-row:last-child {
  border-bottom: 0;
}
.source-ref-row code {
  color: var(--muted);
  font-size: 9px;
}
.source-file-browser {
  overflow: hidden;
}
.source-file-browser-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.source-breadcrumbs {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
  color: var(--text2);
  font: 600 10px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.source-breadcrumbs span + span::before {
  content: "/";
  margin-right: 5px;
  color: var(--muted);
}
.source-file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.source-file-row:last-child {
  border-bottom: 0;
}
.source-file-row:hover {
  background: var(--hover);
}
.source-file-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: var(--bg3);
  color: var(--action);
  font-size: 13px;
}
.source-file-copy {
  min-width: 0;
}
.source-file-copy strong,
.source-file-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-file-copy strong {
  color: var(--text1);
  font-size: 11px;
}
.source-file-copy small {
  margin-top: 2px;
  font-size: 9px;
}
.source-contributor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 9px;
}
.source-contributor-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 13px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.source-contributor-card:hover {
  border-color: var(--line2);
  background: var(--hover-soft);
}
.source-contributor-card.is-anonymous {
  cursor: default;
}
.source-contributor-card.is-anonymous:hover {
  border-color: var(--line);
  background: var(--bg2);
}
.source-contributor-copy {
  min-width: 0;
}
.source-contributor-copy strong,
.source-contributor-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-contributor-copy strong {
  color: var(--text1);
}
.source-contributor-copy small {
  margin-top: 3px;
  font-size: 10px;
}
.source-profile-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 17px;
}
.source-profile-copy h1 {
  margin-bottom: 2px;
}
.source-profile-login {
  color: var(--muted);
  font-size: 13px;
}
.source-profile-copy > p {
  max-width: 650px;
  margin-top: 10px;
  color: var(--text2);
  font-size: 12px;
  line-height: 1.55;
}
.source-profile-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}
.source-profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(250px, 0.68fr);
  gap: 14px;
  align-items: start;
}
.source-profile-main {
  display: grid;
  gap: 24px;
  padding: 0;
}
.source-profile-section {
  min-width: 0;
}
.source-profile-section > h2 {
  margin-bottom: 11px;
  font-size: 17px;
}
.source-mini-repo-list {
  display: grid;
  gap: 8px;
}
.source-mini-repo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
}
.source-mini-repo p {
  margin-top: 4px;
  font-size: 10px;
}
.source-profile-event-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
}
.source-profile-event {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.source-profile-event:last-child {
  border-bottom: 0;
}
.source-profile-event strong {
  color: var(--text1);
  font-size: 11px;
}
.source-profile-event span {
  font-size: 9px;
}
.source-profile-side {
  display: grid;
  gap: 10px;
}
.source-org-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.source-org-row:last-child {
  border-bottom: 0;
}
.source-dialog {
  width: min(980px, calc(100vw - 28px));
  max-width: 980px;
  max-height: min(90dvh, 900px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line2);
  border-radius: var(--panel-radius);
  background: var(--bg2);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.source-dialog::backdrop {
  background: rgba(5, 8, 13, 0.58);
  backdrop-filter: blur(5px);
}
.source-dialog-shell {
  position: relative;
  max-height: inherit;
  overflow: hidden;
}
.source-dialog-close {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg2), transparent 5%);
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}
.source-dialog-close:hover {
  background: var(--hover);
  color: var(--text1);
}
.source-dialog-body {
  max-height: min(90dvh, 900px);
  overflow: auto;
  padding: clamp(18px, 3vw, 28px);
  overscroll-behavior: contain;
}
.source-dialog-heading {
  padding-right: 44px;
}
.source-commit-dialog-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  font-size: 10px;
}
.source-diff-stats {
  margin-block: 18px;
}
.source-diff-files {
  display: grid;
  gap: 11px;
}
.source-diff-file {
  overflow: hidden;
  padding: 0;
}
.source-diff-file-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.source-diff-file-head strong,
.source-diff-file-head small {
  display: block;
}
.source-diff-file-head strong {
  color: var(--text1);
  font: 600 10px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}
.source-diff-file-head small {
  margin-top: 2px;
  font-size: 9px;
}
.source-diff {
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 12px 0;
  background: var(--bg3);
  color: var(--text2);
  font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}
.source-diff span {
  display: inline-block;
  min-width: 100%;
  padding-inline: 12px;
}
.source-diff .add {
  background: color-mix(in srgb, var(--ok), transparent 90%);
  color: color-mix(in srgb, var(--ok), var(--text1) 28%);
}
.source-diff .del {
  background: color-mix(in srgb, var(--danger), transparent 91%);
  color: color-mix(in srgb, var(--danger), var(--text1) 32%);
}
.source-diff .hunk {
  background: color-mix(in srgb, var(--accent), transparent 91%);
  color: var(--action);
}
.source-no-patch {
  padding: 14px;
  font-size: 10px;
}
.source-file-view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-right: 44px;
  margin-bottom: 14px;
}
.source-file-view-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.source-file-code {
  max-height: 66dvh;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg3);
  color: var(--text2);
  font: 10.5px/1.62 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 4;
  white-space: pre;
}
.source-notice {
  min-height: 200px;
  display: grid;
  align-content: center;
  text-align: center;
}
.source-empty {
  padding: 22px;
  border: 1px dashed var(--line2);
  border-radius: var(--card-radius);
  background: var(--bg);
  text-align: center;
}
.source-empty strong {
  color: var(--text1);
}
.source-empty p {
  margin: 5px auto 0;
  max-width: 560px;
  font-size: 11px;
  line-height: 1.55;
}
.source-empty .btn {
  margin-top: 12px;
}
.source-loading-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.source-loading-card {
  height: 150px;
  background: var(--bg2);
  animation: source-loading-pulse 1.15s ease-in-out infinite alternate;
}
@keyframes source-loading-pulse {
  to {
    opacity: 0.58;
  }
}
.source-hub-skeleton {
  min-height: 300px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}
.source-tour-guide.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
@media (max-width: 980px) {
  .source-overview-grid,
  .source-version-grid,
  .source-profile-grid,
  .source-activity-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .source-active-contributors {
    position: static;
  }
  .source-overview-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .source-profile-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .route-source .content {
    padding: 0 !important;
  }
  .source-hub {
    padding: 12px 11px calc(var(--mobile-nav-h, 64px) + env(safe-area-inset-bottom) + 16px);
  }
  .source-hero,
  .source-repo-hero,
  .source-profile-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 19px 16px;
    border-radius: 17px;
  }
  .source-hero-actions,
  .source-repo-hero-actions,
  .source-profile-actions {
    justify-content: flex-start;
  }
  .source-hero-actions .btn,
  .source-repo-hero-actions .btn {
    min-height: 38px;
  }
  .source-live-chip {
    order: -1;
  }
  .source-section-head {
    align-items: stretch;
    flex-direction: column;
  }
  .source-search {
    width: 100%;
  }
  .source-panel {
    padding: 16px 13px;
  }
  .source-architecture-flow {
    grid-template-columns: minmax(0, 1fr);
  }
  .source-overview-side,
  .source-profile-side {
    grid-template-columns: minmax(0, 1fr);
  }
  .source-loading-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .source-profile-identity {
    align-items: flex-start;
  }
  .source-avatar-xl {
    width: 72px;
    height: 72px;
    border-radius: 19px;
  }
  .source-mini-repo {
    align-items: flex-start;
    flex-direction: column;
  }
  .source-file-view-head {
    flex-direction: column;
  }
  .source-file-view-actions {
    justify-content: flex-start;
  }
  .source-dialog {
    width: calc(100vw - 14px);
    max-height: calc(100dvh - 14px);
    border-radius: 17px;
  }
  .source-dialog-body {
    max-height: calc(100dvh - 14px);
    padding: 17px 13px calc(17px + env(safe-area-inset-bottom));
  }
  .source-diff {
    font-size: 9px;
  }
}
@media (max-width: 430px) {
  .source-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .source-repo-grid,
  .source-contributor-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .source-repo-card-top {
    grid-template-columns: minmax(0, 1fr);
  }
  .source-profile-identity {
    flex-direction: column;
  }
  .source-hero-actions > *,
  .source-card-actions > * {
    flex: 1 1 auto;
    justify-content: center;
  }
}
