:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
  --bg-0: #141210;
  --surface-tint: color-mix(in srgb, var(--bg-0) 90%, color-mix(in srgb, var(--accent) 60%, var(--accent-2)));
  --bg-1: color-mix(in srgb, var(--surface-tint) 96%, white);
  --bg-2: color-mix(in srgb, var(--surface-tint) 92%, white);
  --bg-3: color-mix(in srgb, var(--surface-tint) 87%, white);
  --bg-4: color-mix(in srgb, var(--surface-tint) 82%, white);
  --surface-rail: color-mix(in srgb, var(--surface-tint) 88%, black);
  --surface-sidebar: var(--surface-tint);
  --surface-chat: var(--bg-1);
  --surface-header: color-mix(in srgb, var(--surface-tint) 98%, white);
  --surface-input: var(--bg-2);
  --surface-menu: var(--bg-2);
  --surface-hover: var(--bg-3);
  --line: color-mix(in srgb, white 11%, transparent);
  --line-strong: color-mix(in srgb, white 20%, transparent);
  --text: #f5f2ef;
  --text-soft: #d2cbc5;
  --muted: #a49b95;
  --accent: #b97560;
  --accent-2: #965468;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --danger: #ef5f71;
  --danger-soft: rgba(239, 95, 113, .12);
  --success: #35c98b;
  --community-banner: none;
  background: var(--bg-0);
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background:
    radial-gradient(circle at 12% -20%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 34%),
    radial-gradient(circle at 92% 120%, rgba(59,130,246,.08), transparent 35%),
    var(--bg-0);
}
button, input, textarea, select { font: inherit; }
button { border: 0; color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
.hidden { display: none !important; }
.desktop-titlebar { display: none; }
body.desktop-shell .desktop-titlebar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: #111821;
  color: #e8edf4;
  user-select: none;
}
.desktop-titlebar-drag {
  height: 100%;
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 11px;
  -webkit-app-region: drag;
  font-size: 11px;
  font-weight: 650;
}
.desktop-titlebar-drag img { width: 18px; height: 18px; object-fit: contain; }
.desktop-titlebar-controls { height: 100%; display: flex; -webkit-app-region: no-drag; }
.desktop-titlebar-update {
  width: auto !important;
  min-width: 112px;
  margin: 3px 8px 3px 0;
  padding: 0 10px !important;
  border: 1px solid rgba(255,255,255,.16) !important;
  border-radius: 5px !important;
  background: #b97560 !important;
  color: #fff !important;
  font-size: 10px !important;
  font-weight: 700;
}
.desktop-titlebar-update:hover { background: #cb816a !important; }
.desktop-titlebar-controls button {
  width: 46px;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #d5dae2;
  font-size: 14px;
  box-shadow: none;
}
.desktop-titlebar-controls button:hover { background: rgba(255,255,255,.1); }
.desktop-titlebar-controls #desktop-close:hover { background: #c42b3b; color: white; }
body.desktop-shell #app-view { height: calc(100dvh - 34px); }
body.desktop-shell .app-shell { height: 100%; }
body.desktop-shell .auth-view { min-height: calc(100dvh - 34px); height: calc(100dvh - 34px); }
body.desktop-shell { height: 100dvh; padding-top: 34px; }
.subtle { color: var(--muted); font-size: 12px; line-height: 1.4; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eyebrow {
  margin: 0 0 5px;
  color: color-mix(in srgb, var(--accent) 65%, white 25%);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.ui-icon {
  width: 17px;
  height: 17px;
  display: block;
  filter: invert(91%) sepia(5%) saturate(420%) hue-rotate(179deg) brightness(95%);
  opacity: .88;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* Controls */
input:not([type="checkbox"]):not([type="color"]):not([type="file"]),
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
  background: var(--bg-1);
  color: var(--text);
  padding: 9px 11px;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
textarea { resize: vertical; min-height: 82px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #5f6c80; }
input:focus, textarea:focus, select:focus {
  border-color: color-mix(in srgb, var(--accent) 70%, white 8%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
  background: var(--bg-1);
}
select {
  appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, #8190a7 50%),
    linear-gradient(135deg, #8190a7 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 17px,
    calc(100% - 11px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
label {
  display: grid;
  gap: 6px;
  color: #b9c4d4;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .01em;
}
input[type="color"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-1);
  padding: 4px;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
button {
  min-height: 36px;
  border-radius: 8px;
  padding: 8px 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 12px;
  font-weight: 760;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
button:hover:not(:disabled) { filter: brightness(1.07); }
button:active:not(:disabled) { transform: translateY(1px); }
.button-secondary {
  background: var(--bg-4) !important;
  color: #e8edf6 !important;
}
.text-button {
  min-height: 0;
  padding: 4px 7px;
  background: transparent !important;
  color: var(--text-soft);
}
.danger-text { color: #ff8795 !important; }
.danger-button {
  background: #b83c50 !important;
  color: white !important;
}
.danger-outline {
  border: 1px solid rgba(239,95,113,.35) !important;
  background: rgba(239,95,113,.06) !important;
  color: #ff9eaa !important;
}
.icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: transparent;
}
.icon-button:hover { background: rgba(148,163,184,.09); filter: none; }
.form-error { min-height: 17px; margin: 8px 0 0; color: #ff8997; font-size: 11px; }
.field-error { min-height: 0; color: #ff8997; font-size: 10px; font-weight: 650; }
input.field-invalid { border-color: #d76678; box-shadow: 0 0 0 3px rgba(215,102,120,.12); }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form, .staff-inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inline-form input, .staff-inline-form input { min-width: 0; flex: 1; }
.switch-row {
  grid-template-columns: 16px 1fr !important;
  align-items: center;
  gap: 8px !important;
}

/* Custom uploads */
.native-file-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none;
}
.file-picker {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.file-picker-button {
  min-width: 132px;
  background: var(--bg-3) !important;
  color: #e8edf6 !important;
  box-shadow: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.file-picker-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #738197;
  font-size: 10px;
}
.file-picker.has-file .file-picker-name { color: #b9c4d4; }

/* Authentication */
.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 18%, color-mix(in srgb,var(--accent) 22%,transparent), transparent 28%),
    radial-gradient(circle at 82% 80%, color-mix(in srgb,var(--accent-2) 10%,transparent), transparent 30%),
    var(--surface-rail);
}
.auth-card {
  width: min(410px, 100%);
  padding: 30px;
  border: 1px solid color-mix(in srgb,var(--accent) 20%,transparent);
  border-radius: 14px;
  background: var(--bg-2);
  box-shadow: 0 34px 100px rgba(0,0,0,.45);
}
.auth-card h1 { margin: 18px 0 4px; font-size: 25px; letter-spacing: -.03em; }
.auth-card > .subtle { margin-bottom: 18px; }
.auth-card label { margin-top: 12px; }
.brand-mark {
  width: 44px;
  height: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  padding: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 22%, transparent);
}
.brand-mark.large { width: 52px; height: 52px; border-radius: 14px; font-size: 19px; }

/* Application shell */
.app-shell {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0,1fr);
  grid-template-columns: 68px 260px minmax(0,1fr) 252px;
  background: var(--bg-0);
}
.app-shell.home-mode { grid-template-columns: 68px 260px minmax(0,1fr); }
.app-shell.home-mode.group-dm-mode { grid-template-columns: 68px 260px minmax(0,1fr) 252px; }
.community-rail {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 10px 8px;
  background: var(--surface-rail);
  border-right: 1px solid rgba(148,163,184,.09);
}
.rail-brand { flex: 0 0 auto; }
.rail-brand.active { box-shadow: 0 0 0 2px color-mix(in srgb,var(--accent) 48%,transparent); }
.rail-separator { width: 32px; height: 1px; background: var(--line); }
.community-list {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.community-button, .rail-action {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  flex: 0 0 auto;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(148,163,184,.11);
  border-radius: 13px;
  background: var(--bg-2);
  color: #dce4ef;
  box-shadow: none;
}
.community-button:hover, .community-button.active {
  border-color: color-mix(in srgb,var(--accent) 45%,transparent);
  background: linear-gradient(135deg,var(--accent),var(--accent-2));
  filter: none;
}
.community-button.active::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: #fff;
}
.community-button img { width: 100%; height: 100%; object-fit: cover; }
.community-initials { font-size: 12px; font-weight: 900; }
.rail-action { margin-top: auto; background: color-mix(in srgb,var(--accent) 10%,transparent); }

.channel-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
}
.community-header {
  min-height: 60px;
  padding: 9px 10px 9px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(13,20,32,.95), rgba(13,20,32,.80)),
    var(--community-banner);
  background-size: cover;
  background-position: center;
}
.community-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg,var(--accent),var(--accent-2),transparent 75%);
  opacity: .7;
}
.community-title-wrap {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 1px;
  position: relative;
  z-index: 1;
}
.community-title-wrap strong { font-size: 13px; }
.community-title-wrap .subtle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.community-header-actions { display: flex; align-items: center; gap: 1px; position: relative; z-index: 1; }
.channel-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 7px; }
.section-heading {
  margin: 16px 8px 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #65738a;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.dm-section-heading { justify-content: flex-start; gap: 7px; }
.dm-section-heading .ui-icon { width: 14px; height: 14px; opacity: .72; }
.mini-button {
  width: 24px; height: 24px; min-height: 24px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}
.channel-list, .dm-list { display: grid; gap: 2px; }
.channel-button, .special-channel, .dm-button, .home-nav-button {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #93a0b3;
  text-align: left;
  font-size: 12px;
  font-weight: 650;
}
.channel-button:hover, .special-channel:hover, .dm-button:hover, .home-nav-button:hover {
  background: rgba(148,163,184,.075);
  color: #dfe6f0;
  filter: none;
}
.channel-button.active, .dm-button.active, .home-nav-button.active {
  border-color: color-mix(in srgb,var(--accent) 24%,transparent);
  background: color-mix(in srgb,var(--accent) 13%,transparent);
  color: #fff;
}
.channel-glyph {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
}
.channel-image {
  width: 22px; height: 22px; flex: 0 0 22px;
  object-fit: cover; border-radius: 6px;
}
.age-chip {
  margin-left: auto;
  border: 1px solid rgba(239,95,113,.28);
  border-radius: 4px;
  padding: 1px 4px;
  color: #ff97a3;
  font-size: 8px;
  font-weight: 850;
}
.sidebar-empty {
  padding: 10px 8px;
  color: #58667b;
  font-size: 10px;
}

.dm-avatar { width: 28px; height: 28px; flex: 0 0 28px; font-size: 10px; }
.dm-button-copy { min-width: 0; display: grid; flex: 1; gap: 1px; }
.dm-button-copy strong, .dm-button-copy span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dm-button-copy strong { display: flex; align-items: center; min-width: 0; gap: 4px; font-size: 11px; }
.official-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-button-copy .official-verified { flex: 0 0 auto; margin-left: 0; }
.dm-button-copy span { color: #68768b; font-size: 9px; font-weight: 500; }
.group-dm-avatar { display: grid; place-items: center; background: color-mix(in srgb,var(--accent) 26%,var(--bg-3)); }
.group-dm-avatar .ui-icon { width: 15px; height: 15px; }
.dm-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 14px 0; padding: 3px; border-radius: 8px; background: var(--bg-1); }
.dm-mode-switch button { min-height: 34px; background: transparent; color: var(--muted); }
.dm-mode-switch button.active { background: var(--bg-3); color: var(--text); }
#new-group-fields { display: grid; gap: 12px; }
.group-member-picker { display: grid; gap: 7px; min-width: 0; }
.group-member-picker > label { gap: 3px; }
.group-member-suggestions { display: grid; max-height: 190px; overflow-y: auto; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-1); }
.group-member-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; min-height: 38px; padding: 7px 9px; border-radius: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; }
.group-member-option:last-child { border-bottom: 0; }
.group-member-option:hover { background: var(--bg-3); }
.group-member-option strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-member-option span { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.group-member-empty { padding: 10px; color: var(--muted); font-size: 11px; }
.selected-group-members { display: flex; flex-wrap: wrap; gap: 6px; }
.group-member-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 5px 3px 9px; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--bg-3); color: var(--text); font-size: 11px; }
.group-member-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-member-chip button { width: 22px; min-height: 22px; padding: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 16px; }
.group-member-chip button:hover { background: var(--bg-4); color: var(--text); }
.group-add-member-dialog > label { margin: 12px 20px 8px; }
.group-add-member-dialog > .group-member-suggestions { margin: 0 20px 12px; max-height: min(360px,50dvh); }
.group-add-member-dialog > .form-error { margin: 0 20px 14px; }
.user-dock {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 7px;
  border-top: 1px solid var(--line);
  background: var(--bg-1);
}
.user-summary {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  background: transparent;
  text-align: left;
}
.user-summary:hover { background: rgba(148,163,184,.07); filter: none; }
.user-summary-text { min-width: 0; display: grid; gap: 0; }
.user-summary-text strong, .user-summary-text span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-summary-text strong { font-size: 11px; }
.small-avatar { width: 32px; height: 32px; font-size: 10px; }

/* Content */
.content-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% -30%, color-mix(in srgb,var(--accent) 7%,transparent), transparent 45%),
    var(--bg-1);
}
.content-header {
  height: 60px;
  flex: 0 0 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 13px;
  border-bottom: 1px solid var(--line);
  background: rgba(15,22,34,.92);
}
.channel-heading { min-width: 0; display: flex; align-items: center; gap: 9px; }
.channel-heading > div { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.channel-heading strong { font-size: 13px; white-space: nowrap; }
.channel-heading .subtle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-header-icon {
  width: 30px; height: 30px; flex: 0 0 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(148,163,184,.08);
}
.channel-header-image { width: 30px; height: 30px; object-fit: cover; border-radius: 8px; }
.header-avatar { width: 30px; height: 30px; font-size: 10px; }
.empty-state {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}
.empty-icon {
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-2);
  color: #a9b6c8;
  font-weight: 900;
}
.empty-state h2 { margin: 10px 0 0; color: var(--text); font-size: 19px; }
.empty-state p { margin: 0; font-size: 12px; }

.chat-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 20px 8px;
}
.message {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0,1fr);
  gap: 10px;
  padding: 6px 8px;
  margin: 0 -8px 1px;
  border-radius: 7px;
}
.message:hover { background: rgba(148,163,184,.035); z-index: 2; }
.message:focus-within { z-index: 2; }
.message-avatar {
  width: 36px; height: 36px; min-height: 36px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg-4);
  font-size: 10px;
}
.message-body { min-width: 0; }
.message-reply-preview { display: flex; flex-direction: column; align-items: flex-start; max-width: min(560px,100%); margin: 0 0 5px; padding: 4px 8px; border-left: 2px solid var(--accent); background: transparent; color: var(--muted); text-align: left; font-size: 11px; }
.message-reply-preview strong { color: var(--text-soft); font-size: 10px; }
.message-reply-preview span { overflow: hidden; max-width: 100%; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.message-reply-preview:hover { background: var(--surface-hover); }
.message-pinned-label { color: #e3bd73; font-size: 10px; }
.message-link-target { background: color-mix(in srgb,var(--accent) 18%,transparent); outline: 1px solid color-mix(in srgb,var(--accent) 45%,transparent); }
.message-meta { display: flex; align-items: baseline; gap: 7px; }
.message-name {
  min-height: 0;
  padding: 0;
  background: transparent;
  color: #eef3f9;
  font-size: 11px;
  font-weight: 800;
}
.message-name:hover { text-decoration: underline; filter: none; }
.official-verified {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 5px;
  color: #f2c94c;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
  vertical-align: middle;
}
.staff-form {
  display: grid;
  gap: 12px;
  max-width: 720px;
  padding: 16px 0;
}
.staff-form h3, .staff-form p { margin: 0; }
.staff-form p { color: var(--muted); font-size: 12px; }
.staff-form label { display: grid; gap: 6px; color: var(--text); font-size: 12px; font-weight: 700; }
.staff-form input, .staff-form textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px;
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.message-time { color: #59677c; font-size: 9px; }
.message-edited-label { color: var(--muted); font-size: 9px; font-style: italic; }
.message-content {
  margin-top: 2px;
  color: #cbd4e1;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.48;
}
.composer {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 14px 14px;
  padding: 5px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-3);
}
.composer input, .composer textarea {
  min-height: 35px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 7px 4px !important;
}
.composer-tool {
  width: 32px; height: 32px; min-height: 32px;
  padding: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-4);
}
.send-button { min-height: 32px; padding: 6px 11px; }

/* Members */
.member-sidebar {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--bg-1);
}
.member-sidebar.home-hidden { display: none; }
.members-header {
  height: 60px;
  flex: 0 0 60px;
  padding: 8px 10px 8px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.members-header > div { display: flex; align-items: baseline; gap: 7px; }
.members-header-actions { display: flex; align-items: center; gap: 2px; }
.group-member-row { min-width: 0; display: flex; align-items: center; gap: 3px; }
.group-member-profile-button { flex: 1; min-width: 0; }
.group-member-management-actions { display: flex; flex: 0 0 auto; gap: 2px; }
.group-member-action { min-height: 27px; padding: 4px 6px; border-radius: 5px; background: transparent; color: var(--muted); font-size: 9px; white-space: nowrap; }
.group-member-action:hover { background: var(--bg-3); color: var(--text); }
.group-member-action.danger { color: #e98a91; }
.group-member-action.danger:hover { background: rgba(239,95,113,.12); color: #ffabb2; }
.members-header strong { font-size: 12px; }
.member-count {
  color: #637188;
  font-size: 10px;
  font-weight: 750;
}
.member-search-wrap { padding: 7px; border-bottom: 1px solid var(--line); }
.member-search-wrap input { min-height: 34px !important; font-size: 11px; }
.member-list { flex: 1; min-height: 0; overflow-y: auto; padding: 7px; }
.member-group-title {
  margin: 12px 7px 5px;
  color: #627086;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.member-button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 7px;
  background: transparent;
  color: #9daabc;
  text-align: left;
}
.member-button:hover { background: rgba(148,163,184,.07); color: #e4eaf3; filter: none; }
.member-button .avatar { width: 29px; height: 29px; flex: 0 0 29px; font-size: 9px; }
.member-display-name { min-width: 0; flex: 1; font-size: 11px; font-weight: 700; }
.member-role-icon { width: 13px; height: 13px; object-fit: contain; }
.owner-crown { width: 12px !important; height: 12px !important; margin-left: auto; }
.avatar {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg,var(--bg-4),var(--bg-3));
  color: #fff;
  font-weight: 850;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Friends */
.friends-view {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.friends-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
}
.friends-tabs { display: flex; gap: 4px; }
.friends-tab {
  min-height: 32px;
  background: transparent;
  color: #8996a9;
}
.friends-tab.active {
  background: rgba(148,163,184,.10);
  color: #f2f5fa;
}
.add-friend-form {
  margin-left: auto;
  width: min(430px, 52%);
  display: flex;
  gap: 7px;
}
.add-friend-form input { min-height: 34px !important; }
.add-friend-form button { min-height: 34px; white-space: nowrap; }
.friends-list { flex: 1; overflow-y: auto; padding: 12px 16px; }
.social-person-row {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(148,163,184,.08);
  padding: 8px 5px;
}
.social-avatar { width: 36px; height: 36px; flex: 0 0 36px; font-size: 10px; }
.social-person-identity { min-width: 0; flex: 1; display: grid; gap: 1px; }
.social-person-identity strong { font-size: 12px; }
.social-person-identity span { color: #69778c; font-size: 10px; }
.social-person-actions { display: flex; gap: 5px; }
.round-action {
  width: 32px; height: 32px; min-height: 32px;
  padding: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-4);
}
.round-action.danger-action { background: rgba(239,95,113,.11); }
.social-empty {
  min-height: 250px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: var(--muted);
  text-align: center;
}
.social-empty strong { color: var(--text-soft); font-size: 13px; }
.social-empty span { font-size: 11px; }

/* Dialogs */
dialog.modal {
  width: min(520px, calc(100vw - 28px));
  max-height: min(780px, calc(100vh - 28px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0;
  background: var(--bg-2);
  color: var(--text);
  box-shadow: 0 34px 110px rgba(0,0,0,.58);
}
dialog.modal::backdrop {
  background: rgba(2,6,12,.72);
  backdrop-filter: blur(5px);
}
dialog.modal > form,
dialog.modal > .modal-heading,
dialog.modal > .settings-tabs,
dialog.modal > .settings-content,
dialog.modal > #tickets-content,
dialog.modal > #invite-list,
dialog.modal > .dialog-section-heading,
dialog.modal > .invite-create-form,
dialog.modal > .invite-current {
  margin-left: 20px;
  margin-right: 20px;
}
dialog.modal > form { padding: 20px 0; }
dialog.wide-modal { width: min(760px, calc(100vw - 28px)); }
dialog.compact-modal { width: min(420px, calc(100vw - 28px)); }
.channel-pins-list { display: grid; gap: 6px; max-height: min(520px, calc(100vh - 180px)); overflow-y: auto; margin: 16px 20px 20px; }
.channel-pin-item { display: grid; gap: 4px; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-1); color: var(--text); text-align: left; }
.channel-pin-item:hover { border-color: var(--line-strong); background: var(--bg-3); }
.channel-pin-item span { overflow-wrap: anywhere; color: var(--text-soft); font-size: 12px; }
.channel-pin-item time { color: var(--muted); font-size: 10px; }
.global-search-dialog { max-height: min(820px, calc(100dvh - 28px)); }
.global-search-dialog > form { display: flex; flex-direction: column; min-height: 0; max-height: inherit; }
.global-search-input-row { display: flex; align-items: center; gap: 9px; margin: 16px 20px 0; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg-1); }
.global-search-input-row .ui-icon { flex: 0 0 17px; opacity: .65; }
.global-search-input-row input { min-width: 0; min-height: 38px !important; flex: 1; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.global-search-input-row button { flex: 0 0 auto; }
.global-search-filters { display: flex; gap: 4px; margin: 12px 20px 0; overflow-x: auto; scrollbar-width: none; }
.global-search-filters::-webkit-scrollbar { display: none; }
.global-search-filters button { min-height: 30px; flex: 0 0 auto; padding: 5px 9px; background: transparent; color: var(--muted); }
.global-search-filters button.active { background: var(--bg-3); color: var(--text); }
.global-search-results { min-height: 0; flex: 1; overflow-y: auto; margin: 12px 20px 20px; overscroll-behavior: contain; }
.global-search-section + .global-search-section { margin-top: 14px; }
.global-search-section h3 { margin: 0 0 5px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.global-search-result { width: 100%; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); text-align: left; }
.global-search-result:hover { border-color: var(--line); background: var(--bg-3); }
.global-search-result-copy { min-width: 0; display: grid; gap: 3px; }
.global-search-result-copy strong, .global-search-result-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-search-result-copy strong { font-size: 12px; }
.global-search-result-copy span { color: var(--muted); font-size: 10px; }
.global-search-thumbnail { width: 48px; height: 40px; flex: 0 0 48px; object-fit: cover; border-radius: 4px; background: var(--bg-2); }
.global-search-empty { padding: 16px 8px; text-align: center; }
.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
}
form > .modal-heading { padding-top: 0; }
.modal-heading h2 { margin: 0 0 3px; font-size: 18px; letter-spacing: -.025em; }
.modal-heading p { margin-top: 0; }
.modal-heading + label, form > label { margin-top: 13px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  margin-top: 17px;
}
.settings-tabs {
  display: flex;
  gap: 3px;
  margin-top: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.settings-tab {
  background: transparent;
  color: #7e8ba0;
}
.settings-tab.active {
  background: rgba(148,163,184,.09);
  color: #f0f4f9;
}
.settings-content, .staff-content { min-height: 220px; padding-bottom: 20px; }
.settings-card, .ticket-card {
  margin: 9px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-1);
}
.settings-card h3, .ticket-card h3 { margin: 0 0 5px; font-size: 13px; }
.upload-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 10px;
}
.profile-color-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 8px;
}
.role-swatch {
  display: inline-block;
  width: 11px; height: 11px;
  margin-right: 6px;
  border-radius: 50%;
}
.permission-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 6px;
  margin-top: 10px;
}
.permission-grid label { display: flex; align-items: center; gap: 6px; }

/* Community creation */
.community-create-modal { width: min(830px, calc(100vw - 28px)) !important; }
.community-create-grid {
  display: grid;
  grid-template-columns: minmax(170px,210px) minmax(0,1fr);
  gap: 18px;
  margin-top: 18px;
}
.community-create-preview {
  min-height: 280px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-1);
  padding: 105px 13px 14px;
}
.community-create-banner-preview {
  position: absolute;
  inset: 0 0 auto;
  height: 88px;
  background: linear-gradient(135deg,#b97560,#965468);
}
.community-create-icon-preview {
  width: 62px; height: 62px;
  position: absolute;
  top: 56px; left: 13px;
  display: grid; place-items: center;
  overflow: hidden;
  border: 4px solid var(--bg-1);
  border-radius: 17px;
  background: linear-gradient(135deg,#b97560,#965468);
  font-weight: 900;
}
.community-create-preview strong {
  display: block;
  margin-top: 19px;
  font-size: 15px;
}
.community-create-preview > span:last-child {
  display: block;
  margin-top: 4px;
  color: #76849a;
  font-size: 10px;
  line-height: 1.4;
}
.community-create-fields { min-width: 0; }
.community-create-fields > label { margin-top: 12px; }
.community-create-fields > label:first-child { margin-top: 0; }

/* Invites */
.invite-modal { width: min(600px, calc(100vw - 28px)) !important; padding-bottom: 20px !important; }
.invite-create-form { padding: 0 !important; margin-top: 16px; }
.invite-options {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 9px;
  margin-bottom: 9px;
}
.invite-current { margin-top: 14px; }
.invite-link-card {
  padding: 11px;
  border: 1px solid color-mix(in srgb,var(--accent) 28%,transparent);
  border-radius: 9px;
  background: color-mix(in srgb,var(--accent) 8%,var(--bg-1));
}
.invite-link-label { display: block; margin-bottom: 6px; color: #9ba8ba; font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.invite-link-line { display: flex; gap: 7px; }
.invite-link-line input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.copy-invite-button { display: inline-flex; align-items: center; gap: 6px; }
.dialog-section-heading {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #6f7d91;
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.invite-list { display: grid; gap: 5px; margin-top: 7px; }
.invite-row {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 7px;
  background: var(--bg-1);
}
.invite-row.expired { opacity: .45; }
.invite-row-info { min-width: 0; flex: 1; display: grid; gap: 2px; }
.invite-row-info strong { font-family: ui-monospace, monospace; font-size: 10px; }
.invite-row-actions { display: flex; align-items: center; gap: 3px; }
.invite-empty { padding: 18px 8px; color: #68768a; font-size: 10px; text-align: center; }
.invite-join-modal { width: min(430px, calc(100vw - 28px)) !important; overflow: hidden !important; }
.invite-preview-banner { height: 118px; background-size: cover; background-position: center; }
.invite-preview-body { padding: 0 20px 20px; text-align: center; }
.community-preview-icon {
  width: 68px; height: 68px;
  display: grid; place-items: center;
  overflow: hidden;
  margin: -34px auto 10px;
  border: 5px solid var(--bg-2);
  border-radius: 18px;
  background: var(--bg-4);
  font-weight: 900;
}
.community-preview-icon img { width: 100%; height: 100%; object-fit: cover; }
.invite-preview-body h2 { margin: 2px 0 4px; }
.invite-member-count { margin-top: 9px; color: #8e9bae; font-size: 10px; }
.invite-actions { justify-content: center; }

/* Profile cards */
.profile-popout {
  --profile-card: var(--bg-2);
  --profile-accent: #b97560;
  --profile-accent-2: #965468;
  --profile-text: #f8fafc;
  --profile-muted: #9aa6b8;
  width: 330px;
  max-height: min(700px,calc(100vh - 24px));
  position: fixed;
  z-index: 70;
  overflow-y: auto;
  border: 2px solid var(--profile-accent);
  border-radius: 14px;
  background: var(--profile-card);
  color: var(--profile-text);
  box-shadow: 0 28px 90px rgba(0,0,0,.58);
}
.profile-banner {
  height: 104px;
  position: relative;
  background: linear-gradient(135deg,var(--profile-accent),var(--profile-accent-2));
  background-size: cover;
  background-position: center;
}
.profile-banner-actions { position: absolute; z-index: 5; top: 9px; right: 9px; }
.profile-actions-toggle { width: 34px; height: 34px; min-height: 34px; display: grid; place-items: center; padding: 0; border: 1px solid #ffffff40; border-radius: 8px; background: #10151dcc; color: white; backdrop-filter: blur(10px); }
.profile-actions-toggle:hover, .profile-actions-toggle[aria-expanded="true"] { background: #10151df0; }
.profile-actions-menu { position: fixed; z-index: 260; top: 8px; left: 8px; width: 224px; max-height: min(62dvh,440px); overflow-y: auto; padding: 5px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg-2); box-shadow: 0 14px 40px #0009; }
.profile-action-menu-item { width: 100%; min-height: 34px; padding: 7px 9px; border-radius: 5px; background: transparent; color: var(--text); text-align: left; font-size: 11px; }
.profile-action-menu-item:hover { background: var(--bg-3); }
.profile-action-menu-item.danger { color: #f08a94; }
.profile-action-divider { height: 1px; margin: 4px 5px; background: var(--line); }
.profile-banner-shade { position: absolute; inset: 0; background: linear-gradient(to bottom,transparent 50%,rgba(0,0,0,.13)); }
.profile-body { padding: 0 13px 14px; color: var(--profile-text); }
.profile-avatar-row { height: 40px; display: flex; align-items: flex-end; }
.profile-avatar {
  width: 78px; height: 78px;
  margin-top: -42px;
  border: 5px solid var(--profile-card);
  font-size: 22px;
}
.profile-title-copy h3 { margin: 6px 0 1px; font-size: 19px; letter-spacing: -.025em; }
.profile-role-line { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 10px; font-weight: 800; }
.profile-role-icon { width: 13px; height: 13px; object-fit: contain; }
.profile-handle { color: var(--profile-muted); font-size: 10px; }
.profile-status {
  width: fit-content;
  margin-top: 7px;
  padding: 4px 7px;
  border: 1px solid color-mix(in srgb,var(--profile-accent) 28%,transparent);
  border-radius: 6px;
  background: color-mix(in srgb,var(--profile-accent) 9%,transparent);
  font-size: 10px;
}
.badge-row { min-height: 0; display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 6px; }
.profile-badge, .profile-flair {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb,var(--profile-text) 11%,transparent);
  border-radius: 6px;
  background: color-mix(in srgb,var(--profile-text) 7%,transparent);
  color: var(--profile-text);
  font-size: 9px;
  font-weight: 750;
}
.profile-flair { width: 24px; padding: 4px; justify-content: center; }
.profile-badge-icon, .profile-flair img { width: 14px; height: 14px; object-fit: contain; }
.profile-bio { margin: 0; max-height: 60px; overflow: hidden; white-space: pre-wrap; font-size: 10px; line-height: 1.45; }
.profile-bio.expanded { max-height: none; }
.profile-bio-toggle {
  min-height: 0;
  margin-top: 2px;
  padding: 2px 0;
  background: transparent;
  color: var(--profile-muted);
  font-size: 9px;
}
.profile-sections { display: grid; gap: 6px; margin-top: 8px; }
.profile-custom-section {
  padding: 7px;
  border: 1px solid color-mix(in srgb,var(--profile-text) 10%,transparent);
  border-radius: 7px;
  background: color-mix(in srgb,var(--profile-text) 6%,transparent);
}
.profile-section-title { margin-bottom: 5px; font-size: 9px; font-weight: 850; }
.profile-collection-row, .profile-text-chip-row { display: flex; flex-wrap: wrap; gap: 4px; }
.profile-collection-item {
  width: 29px; height: 29px;
  display: grid; place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: color-mix(in srgb,var(--profile-text) 9%,transparent);
  font-size: 8px;
}
.profile-collection-item img { width: 100%; height: 100%; object-fit: cover; }
.profile-text-chip { padding: 3px 6px; border-radius: 999px; background: color-mix(in srgb,var(--profile-accent) 13%,transparent); font-size: 9px; }
.profile-rep { margin-top: 8px; padding-top: 7px; border-top: 1px solid color-mix(in srgb,var(--profile-text) 10%,transparent); color: var(--profile-muted); font-size: 9px; }
.profile-edit-button { width: 100%; margin-top: 9px; display: flex; align-items: center; justify-content: center; gap: 6px; background: linear-gradient(135deg,var(--profile-accent),var(--profile-accent-2)); }
.profile-edit-button .ui-icon { filter: invert(1); }

/* Profile editor */
.server-profile-editor-grid {
  display: grid;
  grid-template-columns: minmax(0,.9fr) minmax(300px,1.1fr);
  gap: 16px;
  margin-top: 15px;
}
.server-profile-fields > label { margin-top: 12px; }
.server-profile-fields > label:first-child { margin-top: 0; }
.profile-builder-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.profile-builder-heading p { margin: 2px 0 0; }
.profile-section-editors { display: grid; gap: 8px; }
.profile-section-editor {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-1);
}
.profile-section-editor-head {
  display: grid;
  grid-template-columns: minmax(0,1fr) 125px 32px;
  gap: 6px;
  align-items: center;
}
.profile-item-editors { display: grid; gap: 5px; margin-top: 7px; }
.profile-item-editor {
  display: grid;
  grid-template-columns: 32px minmax(0,1fr) 120px 30px;
  gap: 6px;
  align-items: center;
}
.profile-item-preview {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-rail);
  color: #647188;
  font-size: 15px;
}
.profile-item-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-builder-remove { color: #ff8b99; }
.profile-add-item { margin-top: 7px; font-size: 10px; }

/* Calls */
.call-view { flex: 1; min-height: 0; overflow: hidden; }
.call-stage {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 13px;
  padding: 16px;
}
.call-stage-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.call-stage-heading h2 { margin: 0 0 3px; font-size: 17px; }
.call-stage-heading p { margin: 0; }
.call-status {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: #9eabba;
  font-size: 9px;
  font-weight: 750;
}
.call-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(300px,100%),1fr));
  grid-auto-rows: minmax(200px,1fr);
  gap: 10px;
  align-content: center;
}
.call-lobby {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px dashed color-mix(in srgb,var(--accent) 28%,transparent);
  border-radius: 12px;
  background: color-mix(in srgb,var(--accent) 5%,var(--bg-1));
  text-align: center;
}
.call-lobby h3 { margin: 5px 0 0; font-size: 17px; }
.call-lobby p { margin: 0 0 7px; }
.call-hero-icon { width: 46px; height: 46px; padding: 12px; border-radius: 13px; background: linear-gradient(135deg,var(--accent),var(--accent-2)); filter: invert(1); }
.call-tile { min-height: 200px; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.call-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; background: #03060a; }
.call-tile.has-video video { opacity: 1; }
.call-tile.has-video .call-tile-fallback { display: none; }
.call-tile-fallback { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px; }
.call-avatar { width: 65px; height: 65px; font-size: 18px; }
.call-tile-name { position: absolute; left: 9px; bottom: 9px; padding: 5px 7px; border-radius: 6px; background: rgba(3,7,13,.72); font-size: 9px; font-weight: 750; }
.call-controls { display: flex; justify-content: center; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg-2); }
.call-control { min-width: 75px; display: grid; justify-items: center; gap: 3px; padding: 7px 10px; background: var(--bg-4); }
.call-control img { width: 17px; height: 17px; filter: invert(1); }
.call-control span { font-size: 9px; }
.call-control.active { background: color-mix(in srgb,var(--accent) 36%,var(--bg-4)); }
.danger-control { background: #a5364a !important; }

/* Staff panel */
dialog.staff-modal {
  width: min(1120px, calc(100vw - 24px));
  height: min(820px, calc(100vh - 24px));
  max-height: none;
  overflow: hidden;
  background: var(--bg-1);
}
.staff-shell { height: 100%; display: grid; grid-template-columns: 205px minmax(0,1fr); }
.staff-nav {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 13px 9px;
  border-right: 1px solid var(--line);
  background: var(--bg-1);
}
.staff-nav-brand {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px 12px;
  border-bottom: 1px solid var(--line);
}
.staff-nav-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb,var(--accent) 16%,var(--bg-2));
}
.staff-nav-brand > div { min-width: 0; display: grid; gap: 1px; }
.staff-nav-brand strong { font-size: 11px; }
.staff-nav-brand span:last-child { color: #6d7a8e; font-size: 9px; }
.staff-nav nav { display: grid; gap: 2px; padding-top: 10px; }
.staff-tab {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 7px;
  background: transparent;
  color: #8592a5;
  text-align: left;
  font-size: 10px;
}
.staff-tab:hover { background: rgba(148,163,184,.07); filter: none; }
.staff-tab.active { background: color-mix(in srgb,var(--accent) 13%,transparent); color: #f1f4f8; }
.staff-close {
  margin-top: auto;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  color: #7d899c;
  font-size: 10px;
}
.staff-workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.staff-workspace-header {
  min-height: 70px;
  padding: 15px 20px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
}
.staff-workspace-header h2 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.staff-content { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 24px; }
.staff-report-list { display: grid; gap: 9px; margin-top: 12px; }
.staff-report-card { display: grid; gap: 8px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-1); }
.staff-report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.staff-report-head strong { min-width: 0; font-size: 12px; }
.staff-report-card small { color: var(--muted); font-size: 10px; }
.staff-report-reason { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-soft); font-size: 12px; }
.staff-report-card blockquote { margin: 0; padding: 8px 10px; border-left: 2px solid var(--accent); background: var(--bg-2); color: var(--text-soft); font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-status { flex: 0 0 auto; padding: 3px 7px; border-radius: 12px; background: var(--bg-3); color: var(--muted); font-size: 9px; text-transform: capitalize; }
.report-status-open { background: #a8495233; color: #ff9aa3; }
.report-status-in_review { background: #b3833033; color: #efc46d; }
.report-filter-bar select { min-width: 140px; }
.staff-stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.staff-stat { display: grid; gap: 2px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg-2); }
.staff-stat strong { font-size: 20px; }
.staff-stat span { color: #c2ccd9; font-size: 10px; font-weight: 800; }
.staff-stat small { color: #5f6d81; font-size: 8px; line-height: 1.35; }
.staff-section { margin-top: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg-1); }
.staff-section-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.staff-section-head h3 { margin: 0; font-size: 12px; }
.staff-section-head p { margin: 3px 0 0; color: #6c7a8f; font-size: 9px; }
.staff-permission-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.staff-permission-grid span { padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; color: #8f9cae; font-size: 8px; }
.staff-search {
  height: 42px;
  display: grid;
  grid-template-columns: 18px minmax(0,1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 4px 4px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-1);
}
.staff-search input { min-height: 32px !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.staff-search button { min-height: 32px; }
.staff-result-list { display: grid; gap: 7px; margin-top: 10px; }
.staff-empty { min-height: 150px; display: grid; place-items: center; align-content: center; gap: 3px; color: #66748a; text-align: center; }
.staff-empty strong { color: #aab5c4; font-size: 12px; }
.staff-empty span { font-size: 9px; }

.staff-user-card, .staff-entity-card, .staff-dm-thread, .staff-audit-entry {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-1);
  overflow: hidden;
}
.staff-user-summary {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
}
.staff-user-avatar { width: 36px; height: 36px; flex: 0 0 36px; font-size: 10px; }
.staff-user-identity { min-width: 0; flex: 1; display: grid; gap: 1px; }
.staff-user-identity strong { font-size: 11px; }
.staff-user-identity span { color: #79869a; font-size: 9px; }
.staff-user-identity small { color: #5e6b7e; font-size: 8px; }
.staff-user-detail { padding: 0 10px 12px; border-top: 1px solid var(--line); }
.staff-detail-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; margin: 9px 0; }
.staff-detail-grid > div { display: grid; gap: 2px; padding: 8px; border-radius: 7px; background: var(--bg-1); }
.staff-detail-grid span { color: #647287; font-size: 8px; }
.staff-detail-grid strong { font-size: 9px; }
.staff-id-line {
  min-height: 34px;
  display: grid;
  grid-template-columns: 82px minmax(0,1fr) 30px;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 5px 4px 8px;
  border-radius: 7px;
  background: var(--bg-1);
}
.staff-id-line > span { color: #667489; font-size: 8px; font-weight: 750; }
.staff-id-line code { overflow: hidden; text-overflow: ellipsis; color: #aab5c4; font-size: 8px; }
.staff-user-actions { display: grid; gap: 8px; }
.staff-action-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.staff-action-row input, .staff-action-row select { min-width: 160px; flex: 1; }
.staff-community-tool-list { display: grid; gap: 10px; margin-top: 12px; }
.staff-community-tool-target { display: grid; gap: 3px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--bg-1); }
.staff-community-tool-target strong { font-size: 13px; }
.staff-community-tool-target span { color: var(--muted); font-size: 10px; }
.staff-community-tool-form { grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); align-items: end; }
.staff-community-tool-form > label { min-width: 0; }
.staff-community-tool-form > button { justify-self: start; }
.staff-action { min-height: 33px; white-space: nowrap; }
.staff-reason { margin: 0 0 8px; color: #c38e96; font-size: 9px; }
.staff-notes { display: grid; gap: 5px; margin-bottom: 7px; }
.staff-notes article { padding: 7px; border-radius: 6px; background: var(--bg-1); }
.staff-notes p { margin: 0 0 3px; color: #bbc5d2; font-size: 9px; }
.staff-notes small { color: #5f6c80; font-size: 8px; }
.staff-entity-card { padding: 10px; }
.staff-entity-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.staff-entity-head > div { min-width: 0; display: grid; gap: 2px; }
.staff-entity-head strong { font-size: 11px; }
.staff-entity-head span { color: #6e7b8f; font-size: 9px; }
.staff-danger-zone { display: flex; gap: 6px; margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(239,95,113,.15); }
.staff-danger-zone input { flex: 1; }
.staff-privacy-notice { display: grid; gap: 2px; margin-bottom: 10px; padding: 10px; border: 1px solid rgba(245,158,11,.22); border-radius: 8px; background: rgba(245,158,11,.06); }
.staff-privacy-notice strong { color: #f4c270; font-size: 10px; }
.staff-privacy-notice span { color: #a48e6a; font-size: 9px; }
.staff-review-form { display: grid; grid-template-columns: .7fr 1.3fr auto; gap: 8px; align-items: end; }
.staff-dm-results { display: grid; gap: 7px; margin-top: 10px; }
.staff-dm-thread { padding: 10px; }
.staff-dm-thread > div:first-child { display: grid; gap: 2px; }
.staff-dm-thread strong { font-size: 10px; }
.staff-dm-thread span { color: #667489; font-size: 8px; }
.staff-transcript { max-height: 310px; overflow-y: auto; display: grid; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.staff-transcript article { padding: 7px; border-radius: 6px; background: var(--bg-1); }
.staff-transcript article > div { display: flex; justify-content: space-between; gap: 10px; }
.staff-transcript strong, .staff-transcript time { font-size: 8px; }
.staff-transcript time { color: #5f6c80; }
.staff-transcript p { margin: 4px 0 0; color: #b8c2d0; font-size: 9px; white-space: pre-wrap; }

.achievement-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 7px; }
.achievement-card { min-height: 54px; display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-1); }
.achievement-icon { width: 34px; height: 34px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: color-mix(in srgb,var(--accent) 10%,var(--bg-2)); }
.achievement-icon img { max-width: 22px; max-height: 22px; object-fit: contain; }
.achievement-card > div { min-width: 0; display: grid; gap: 2px; }
.achievement-card strong { font-size: 9px; }
.achievement-card span { color: #667489; font-size: 8px; }
.staff-create-badge { display: grid; grid-template-columns: 1fr 1.4fr 1fr auto; gap: 8px; align-items: end; }
.staff-audit-list { display: grid; gap: 5px; margin-top: 10px; }
.staff-audit-entry { padding: 8px 10px; }
.staff-audit-entry > div { display: flex; justify-content: space-between; gap: 10px; }
.staff-audit-entry strong { font-size: 9px; }
.staff-audit-entry time, .staff-audit-entry > span { color: #667489; font-size: 8px; }
.staff-audit-entry pre { margin: 5px 0 0; overflow-x: auto; color: #94a2b5; font: 8px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.moderation-log-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 4px 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-2); }
.moderation-log-toolbar label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.moderation-log-toolbar select { min-width: 170px; min-height: 34px; padding: 5px 28px 5px 9px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface-input); color: var(--text); font: inherit; font-size: 11px; }
.moderation-log-total { padding-bottom: 8px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.moderation-log-list { display: grid; gap: 0; margin: 0 0 0 7px; border-left: 1px solid var(--line-strong); }
.moderation-log-entry { position: relative; min-width: 0; margin-left: 16px; padding: 3px 2px 18px 0; }
.moderation-log-entry + .moderation-log-entry { padding-top: 15px; border-top: 1px solid var(--line); }
.moderation-log-entry::before { position: absolute; top: 8px; left: -21px; width: 9px; height: 9px; border: 2px solid var(--bg-1); border-radius: 50%; background: var(--accent); content: ""; }
.moderation-log-entry[data-kind="timeout"]::before { background: #e2ae38; }
.moderation-log-entry[data-kind="ban"]::before,
.moderation-log-entry[data-kind="removal"]::before { background: #dc5965; }
.moderation-log-entry[data-kind="restored"]::before { background: #55ad82; }
.moderation-log-entry[data-kind="content"]::before { background: #7295cc; }
.moderation-log-title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.moderation-log-title-row strong { min-width: 0; color: var(--text); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.moderation-log-title-row time { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.moderation-log-summary { margin: 5px 0 0; color: var(--text-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.moderation-log-detail { margin: 6px 0 0; color: var(--muted); font-size: 10px; font-weight: 600; }
.moderation-log-reason { margin-top: 8px; padding: 7px 10px; border-left: 2px solid var(--line-strong); border-radius: 0 4px 4px 0; background: color-mix(in srgb,var(--bg-2) 72%,transparent); }
.moderation-log-reason strong { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.moderation-log-reason p { margin: 3px 0 0; color: var(--text-soft); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.moderation-log-empty { margin: 0; padding: 18px 12px; color: var(--muted); font-size: 12px; }
@media (max-width: 520px) {
  .moderation-log-toolbar { align-items: stretch; }
  .moderation-log-toolbar select { min-width: 0; width: 100%; }
  .moderation-log-title-row time { flex-basis: 100%; }
}

/* Responsive */
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 64px 245px minmax(0,1fr); }
  .app-shell.home-mode { grid-template-columns: 64px 245px minmax(0,1fr); }
  .app-shell.home-mode.group-dm-mode { grid-template-columns: 64px 245px minmax(0,1fr); }
  .member-sidebar {
    display: none;
    position: fixed;
    z-index: 45;
    right: 0; top: 0; bottom: 0;
    width: 250px;
    box-shadow: -18px 0 55px rgba(0,0,0,.45);
  }
  .member-sidebar.open { display: flex; }
  .staff-stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .community-create-grid, .server-profile-editor-grid { grid-template-columns: 1fr; }
  .community-create-preview { min-height: 220px; }
  .upload-grid, .profile-color-grid { grid-template-columns: 1fr; }
  .staff-shell { grid-template-columns: 155px minmax(0,1fr); }
  .staff-review-form, .staff-create-badge { grid-template-columns: 1fr; }
  .profile-item-editor { grid-template-columns: 32px minmax(0,1fr) 30px; }
  .profile-item-editor .file-picker { grid-column: 2 / 3; }
}
@media (max-width: 640px) {
  .app-shell, .app-shell.home-mode { grid-template-columns: 58px minmax(0,1fr); }
  .channel-sidebar {
    position: fixed;
    left: 58px; top: 0; bottom: 0;
    z-index: 40;
    width: 242px;
    box-shadow: 14px 0 45px rgba(0,0,0,.40);
  }
  .content-pane { grid-column: 2; }
  .friends-toolbar { align-items: stretch; flex-direction: column; }
  .add-friend-form { width: 100%; margin-left: 0; }
}

/* Settings management */
.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.settings-card-head > div { min-width: 0; }
.settings-card-head h3 { margin: 0; }
.settings-card-head p { margin: 3px 0 0; }
.settings-form { display: grid; gap: 10px; }
.settings-field-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) 150px;
  gap: 9px;
}
.settings-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  padding-top: 4px;
}
.settings-toggle-editor {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 10px;
}
.settings-readonly {
  display: grid;
  gap: 3px;
  padding: 9px;
  border-radius: 7px;
  background: var(--bg-1);
}
.settings-readonly strong { font-size: 11px; }
.settings-readonly span { color: #68768b; font-size: 9px; }
.role-preview {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--bg-1);
}
.role-preview img { width: 19px; height: 19px; object-fit: contain; }
.role-preview strong { font-size: 11px; }
.role-editor { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.role-priority-note { margin: 0 0 9px; }
.role-priority-list { display: grid; gap: 9px; }
.role-priority-row { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; align-items: stretch; }
.role-priority-row.can-reorder { grid-template-columns: 34px minmax(0,1fr); }
.role-priority-item { min-width: 0; }
.role-priority-row.dragging .role-priority-item { opacity: .55; }
.role-priority-row.drop-target .role-priority-item { outline: 2px solid var(--accent); outline-offset: 1px; }
.role-priority-controls { display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 6px; }
.role-priority-controls .icon-button { width: 30px; min-width: 30px; height: 30px; min-height: 30px; padding: 0; }
.role-priority-handle { cursor: grab; touch-action: none; user-select: none; color: var(--muted); font-size: 15px; }
.role-priority-handle:active { cursor: grabbing; }
.role-priority-move { color: var(--text-soft); font-size: 16px; }
.role-priority-move:disabled { opacity: .28; }
.member-settings-row {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr);
  gap: 10px;
  align-items: start;
}
.member-settings-avatar { width: 38px; height: 38px; font-size: 10px; }
.member-settings-management { min-width: 0; display: grid; gap: 9px; }
.member-role-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.member-role-checks label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-1);
  font-size: 9px;
}
.member-moderation-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.member-moderation-actions input { min-width: 0; flex: 1; min-height: 34px !important; }
.member-moderation-actions button { min-height: 34px; }
.ban-list { display: grid; gap: 5px; }
.ban-row {
  min-height: 46px;
  display: grid;
  grid-template-columns: 32px minmax(0,1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border-radius: 7px;
  background: var(--bg-1);
}
.ban-row .avatar { width: 30px; height: 30px; font-size: 9px; }
.ban-row > div { min-width: 0; display: grid; gap: 1px; }
.ban-row strong { font-size: 10px; }
.ban-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #69778c; font-size: 8px; }

/* Product polish pass */
dialog.modal {
  border-radius: 16px;
  border-color: rgba(148,163,184,.18);
  box-shadow: 0 28px 90px rgba(0,0,0,.58);
}
.modal-heading {
  padding-bottom: 14px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(148,163,184,.09);
}
.modal-heading h2 {
  font-size: 21px;
  letter-spacing: -.025em;
}
.modal-heading .subtle { font-size: 12px; }

dialog.wide-modal {
  width: min(920px, calc(100vw - 40px));
}
.server-profile-editor-grid {
  grid-template-columns: minmax(300px,.82fr) minmax(380px,1.18fr);
  gap: 24px;
  margin-top: 20px;
}
.server-profile-fields {
  padding-right: 20px;
  border-right: 1px solid rgba(148,163,184,.10);
}
.server-profile-fields > label { margin-top: 16px; }
.server-profile-fields > label:first-child { margin-top: 0; }
.profile-builder-heading {
  min-height: 44px;
  align-items: center;
  margin-bottom: 12px;
}
.profile-builder-heading strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}
.profile-builder-heading .subtle { font-size: 11px; }
.profile-section-editor {
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-1);
}
.profile-section-editor-head {
  grid-template-columns: minmax(0,1fr) 150px 34px;
  gap: 9px;
}
.profile-section-editor-head input,
.profile-section-editor-head select {
  min-height: 42px;
}
.profile-item-editors {
  gap: 9px;
  margin-top: 11px;
}
.profile-item-editor {
  grid-template-columns: 40px minmax(0,1fr) 150px 34px;
  gap: 9px;
}
.profile-item-preview {
  width: 40px;
  height: 40px;
}
.profile-item-editor > input[name="itemLabel"] { min-height: 40px; }
.profile-add-item {
  margin-top: 10px;
  min-height: 34px;
}
.profile-color-grid {
  gap: 10px;
  margin-top: 2px;
}
.profile-color-grid label { font-size: 11px; }
.profile-color-grid input[type="color"] { height: 44px; }

.file-picker {
  display: grid;
  grid-template-columns: minmax(124px,auto) minmax(0,1fr);
  gap: 10px;
  align-items: center;
}
.file-picker-button {
  min-width: 124px;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid rgba(148,163,184,.16);
  border-radius: 9px;
  background: var(--bg-3) !important;
}
.file-picker-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #78869a;
  font-size: 11px;
}
.file-picker.has-file .file-picker-button {
  border-color: color-mix(in srgb,var(--accent) 38%,transparent);
  background: color-mix(in srgb,var(--accent) 10%,var(--bg-3)) !important;
}
.native-file-input {
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}

/* Member rail */
.member-sidebar {
  width: auto;
  background: var(--bg-1);
}
.members-header {
  min-height: 60px;
  padding: 0 14px;
}
.members-header > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.members-header strong { font-size: 13px; }
.member-count {
  color: #68768a;
  font-size: 10px;
  font-weight: 800;
}
.member-search-wrap {
  padding: 10px 10px 4px;
}
.member-search-wrap input {
  min-height: 34px !important;
  font-size: 11px;
}
.member-list { padding: 8px 8px 18px; }
.member-group-title {
  margin: 14px 9px 6px;
  color: #647287;
  font-size: 9px;
  letter-spacing: .08em;
}
.member-button {
  min-height: 42px;
  padding: 6px 8px;
  gap: 9px;
  border-radius: 8px;
}
.member-button .avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}
.member-display-name {
  font-size: 11px;
  font-weight: 720;
}

/* Staff workspace, intentionally calmer and roomier */
dialog.staff-modal {
  width: min(1240px, calc(100vw - 30px));
  height: min(860px, calc(100vh - 30px));
  border-radius: 18px;
}
.staff-shell { grid-template-columns: 220px minmax(0,1fr); }
.staff-nav {
  padding: 18px 12px;
  background: var(--surface-rail);
}
.staff-nav-brand {
  min-height: 58px;
  gap: 11px;
  padding: 8px 10px 16px;
}
.staff-nav-mark { width: 36px; height: 36px; }
.staff-nav-brand strong { font-size: 13px; }
.staff-nav-brand span:last-child { font-size: 10px; }
.staff-nav nav { gap: 4px; padding-top: 14px; }
.staff-tab {
  min-height: 39px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 680;
}
.staff-tab.active {
  box-shadow: inset 3px 0 0 var(--accent);
  background: color-mix(in srgb,var(--accent) 12%,transparent);
}
.staff-workspace-header {
  min-height: 82px;
  padding: 19px 24px 15px;
}
.staff-workspace-header h2 { font-size: 22px; }
.staff-content { padding: 20px 24px 30px; }
.staff-stat-grid { gap: 12px; }
.staff-stat {
  gap: 4px;
  padding: 16px;
  border-radius: 11px;
}
.staff-stat strong { font-size: 24px; }
.staff-stat span { font-size: 11px; }
.staff-stat small { font-size: 9px; }
.staff-section {
  margin-top: 16px;
  padding: 16px;
  border-radius: 11px;
}
.staff-section-head { margin-bottom: 12px; }
.staff-section-head h3 { font-size: 14px; }
.staff-section-head p { font-size: 10px; }
.staff-search {
  height: 46px;
  border-radius: 10px;
}
.staff-search input { font-size: 12px; }
.staff-result-list { gap: 10px; margin-top: 13px; }
.staff-user-card,
.staff-entity-card,
.staff-dm-thread,
.staff-audit-entry {
  border-radius: 11px;
}
.staff-user-summary {
  min-height: 68px;
  gap: 12px;
  padding: 10px 13px;
}
.staff-user-avatar {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
}
.staff-user-identity strong { font-size: 13px; }
.staff-user-identity span { font-size: 10px; }
.staff-user-identity small { font-size: 9px; }
.staff-user-detail { padding: 0 13px 15px; }
.staff-detail-grid { gap: 9px; margin: 12px 0; }
.staff-detail-grid > div { padding: 10px; }
.staff-detail-grid span { font-size: 9px; }
.staff-detail-grid strong { font-size: 10px; }
.staff-id-line { min-height: 38px; }
.staff-id-line > span,
.staff-id-line code { font-size: 9px; }
.staff-action { min-height: 36px; }
.staff-notes p { font-size: 10px; }
.staff-notes small { font-size: 9px; }
.staff-entity-card,
.staff-dm-thread { padding: 13px; }
.staff-entity-head strong { font-size: 13px; }
.staff-entity-head span { font-size: 10px; }
.staff-privacy-notice { padding: 13px; }
.staff-privacy-notice strong { font-size: 12px; }
.staff-privacy-notice span { font-size: 10px; }
.staff-transcript strong,
.staff-transcript time { font-size: 9px; }
.staff-transcript p { font-size: 10px; }
.achievement-card {
  min-height: 64px;
  padding: 10px;
}
.achievement-card strong { font-size: 11px; }
.achievement-card span { font-size: 9px; }
.staff-audit-entry { padding: 10px 12px; }
.staff-audit-entry strong { font-size: 10px; }
.staff-audit-entry time,
.staff-audit-entry > span { font-size: 9px; }
.staff-audit-entry pre { font-size: 9px; }

/* Profile rendering repair */
.profile-banner {
  overflow: hidden;
}
.profile-avatar-row {
  position: relative;
  height: 44px;
  overflow: visible;
}
.profile-avatar {
  position: absolute;
  left: 0;
  top: -42px;
  z-index: 3;
  width: 78px !important;
  height: 78px !important;
  margin: 0 !important;
  border: 5px solid var(--profile-card);
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-title-row {
  position: relative;
  z-index: 2;
}
.profile-popout .badge-row {
  gap: 6px;
  margin: 9px 0 7px;
}
.profile-popout .profile-badge {
  position: relative;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 5px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb,var(--profile-text) 13%,transparent);
  border-radius: 7px;
  background: color-mix(in srgb,var(--profile-text) 7%,transparent);
  cursor: default;
}
.profile-popout .profile-badge:hover,
.profile-popout .profile-badge:focus-visible {
  border-color: color-mix(in srgb,var(--profile-accent) 55%,transparent);
  background: color-mix(in srgb,var(--profile-accent) 12%,transparent);
  outline: none;
}
.profile-popout .profile-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 90;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(3px);
  width: max-content;
  max-width: 220px;
  padding: 6px 8px;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 6px;
  background: var(--surface-rail);
  color: #edf2f8;
  box-shadow: 0 10px 28px rgba(0,0,0,.42);
  font-size: 10px;
  line-height: 1.35;
  font-weight: 650;
  white-space: normal;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}
.profile-popout .profile-badge:hover::after,
.profile-popout .profile-badge:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.profile-badge-icon {
  width: 16px !important;
  height: 16px !important;
  object-fit: contain;
}

/* Presence */
.presence-avatar {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}
.presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--bg-1);
  border-radius: 50%;
  background: #586174;
  box-sizing: border-box;
}
.presence-online { background: #23c483; }
.presence-idle {
  background: #f0b64d;
  border-radius: 50%;
}
.presence-idle::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  right: -1px;
  top: -2px;
  border-radius: 50%;
  background: var(--bg-1);
}
.presence-dnd {
  background: #ef5f71;
}
.presence-dnd::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--bg-1);
}
.presence-offline {
  background: #4a5568;
  box-shadow: inset 0 0 0 2px var(--bg-1);
}
.member-button .presence-avatar,
.dm-button .presence-avatar,
.social-person-row .presence-avatar {
  flex: 0 0 auto;
}

/* Account settings */
.account-settings-modal {
  width: min(680px, calc(100vw - 32px));
}
.account-settings-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.account-setting-card {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(190px,240px);
  align-items: center;
  gap: 18px;
  padding: 16px;
}
.account-setting-card h3 {
  margin: 0 0 4px;
  font-size: 14px;
}
.account-setting-card p { margin: 0; }
.advanced-switch {
  align-self: start;
  justify-self: stretch;
}
.account-public-id-row {
  grid-column: 1 / -1;
  min-height: 42px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) 34px;
  align-items: center;
  gap: 10px;
  padding: 6px 7px 6px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-1);
}
.account-public-id-row > span {
  color: #718096;
  font-size: 10px;
  font-weight: 750;
}
.account-public-id-row code {
  color: #cbd5e1;
  font-size: 11px;
}

/* Custom app confirmations */
.app-confirm-dialog {
  width: min(410px, calc(100vw - 28px));
  padding: 22px !important;
  text-align: center;
}
.confirm-dialog-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: rgba(245,158,11,.11);
}
.confirm-dialog-icon .ui-icon {
  width: 22px;
  height: 22px;
}
.app-confirm-dialog h2 {
  margin: 0 0 7px;
  font-size: 18px;
}
.app-confirm-dialog > .subtle {
  margin: 0 auto;
  max-width: 330px;
}
.confirm-dialog-actions {
  justify-content: center;
  margin-top: 18px;
}

/* Profile status + advanced ID */
.profile-meta-line {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.profile-presence {
  position: relative;
  padding-left: 10px;
  color: var(--profile-muted);
  font-size: 9px;
  font-weight: 700;
}
.profile-presence::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #566174;
}
.profile-presence.presence-text-online::before { background: #23c483; }
.profile-presence.presence-text-idle::before { background: #f0b64d; }
.profile-presence.presence-text-dnd::before { background: #ef5f71; }
.profile-public-id {
  min-height: 0;
  margin-top: 4px;
  padding: 3px 5px;
  border-radius: 5px;
  background: transparent !important;
  color: var(--profile-muted);
  box-shadow: none !important;
  font: 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.profile-public-id:hover {
  background: color-mix(in srgb,var(--profile-text) 7%,transparent) !important;
  filter: none !important;
}

/* Context menu */
.app-context-menu {
  position: fixed;
  z-index: 220;
  width: 230px;
  max-height: min(520px, calc(100vh - 16px));
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(148,163,184,.16);
  border-radius: 10px;
  background: var(--surface-rail);
  box-shadow: 0 20px 60px rgba(0,0,0,.62);
}
.context-menu-header {
  padding: 7px 9px 6px;
  overflow: hidden;
  color: #7d8a9e;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .07em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.context-menu-item {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 7px;
  background: transparent !important;
  color: #cbd5e1;
  box-shadow: none !important;
  text-align: left;
  font-size: 11px;
  font-weight: 650;
}
.context-menu-item:hover:not(:disabled) {
  background: color-mix(in srgb,var(--accent) 17%,transparent) !important;
  color: white;
  filter: none !important;
}
.context-menu-item small {
  overflow: hidden;
  color: #64748b;
  font: 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-overflow: ellipsis;
}
.context-menu-item.danger { color: #fb8b98; }
.context-menu-item.danger:hover:not(:disabled) {
  background: rgba(239,95,113,.12) !important;
}
.context-menu-separator {
  height: 1px;
  margin: 5px 4px;
  background: rgba(148,163,184,.11);
}

/* Staff award form */
.staff-award-form {
  display: grid;
  grid-template-columns: minmax(220px,.8fr) minmax(220px,1fr) auto;
  gap: 10px;
  align-items: end;
}
.staff-award-form > button {
  min-height: 40px;
  white-space: nowrap;
}
.staff-award-note {
  grid-column: 1 / -1;
  margin: 0;
}
.mobile-only { display: none; }

/* Mobile is a drawer layout, not a scaled desktop layout */
@media (max-width: 760px) {
  html, body {
    width: 100%;
    height: 100dvh;
  }

  .app-shell,
  .app-shell.home-mode {
    height: 100dvh;
    grid-template-columns: 56px minmax(0,1fr) !important;
  }

  .community-rail {
    grid-column: 1;
    grid-row: 1;
    width: 56px;
    padding: 8px 6px;
    gap: 7px;
    z-index: 75;
  }

  .community-button,
  .rail-action {
    width: 40px;
    height: 40px;
    min-height: 40px;
    border-radius: 12px;
  }

  .rail-separator { width: 28px; }

  .channel-sidebar {
    display: flex !important;
    position: fixed !important;
    z-index: 70;
    left: 56px !important;
    top: 0;
    bottom: 0;
    width: min(292px, calc(100vw - 56px)) !important;
    transform: translateX(-105%);
    transition: transform .18s ease;
    box-shadow: 18px 0 48px rgba(0,0,0,.52);
  }

  .channel-sidebar.mobile-open {
    transform: translateX(0);
  }

  .content-pane {
    grid-column: 2 !important;
    grid-row: 1;
    min-width: 0;
    width: 100%;
  }

  .content-header {
    min-height: 54px;
    gap: 7px;
    padding: 0 9px;
  }

  .mobile-only {
    display: grid;
    flex: 0 0 auto;
  }

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

  .channel-heading > div {
    min-width: 0;
  }

  .channel-heading strong,
  .channel-heading .subtle {
    overflow: hidden;
    display: block;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .member-sidebar {
    display: flex !important;
    position: fixed !important;
    z-index: 85;
    right: 0;
    left: auto !important;
    top: 0;
    bottom: 0;
    width: min(286px, calc(100vw - 56px)) !important;
    transform: translateX(105%);
    transition: transform .18s ease;
    box-shadow: -18px 0 48px rgba(0,0,0,.52);
  }

  .member-sidebar.open {
    transform: translateX(0);
  }

  .member-sidebar.home-hidden {
    display: none !important;
  }

  .messages {
    padding: 12px 8px 8px;
  }

  .message {
    gap: 9px;
    padding: 7px 4px;
  }

  .message-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  .message-content {
    overflow-wrap: anywhere;
  }

  .composer {
    margin: 0 8px max(8px, env(safe-area-inset-bottom));
    padding: 6px;
  }

  .composer .send-button {
    width: auto;
    min-width: 62px;
  }

  .friends-toolbar {
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
    padding: 10px;
  }

  .friends-tabs {
    width: 100%;
  }

  .friends-tab {
    flex: 1;
  }

  .add-friend-form {
    width: 100% !important;
    margin-left: 0 !important;
  }

  .friends-list {
    padding: 8px 10px 16px;
  }

  .social-person-row {
    padding: 9px 6px;
  }

  dialog.modal {
    width: calc(100vw - 16px) !important;
    max-width: none !important;
    max-height: calc(100dvh - 16px) !important;
    padding: 16px;
    border-radius: 14px;
  }

  dialog.wide-modal {
    width: 100vw !important;
    height: 100dvh !important;
    max-height: none !important;
    margin: 0;
    padding: 16px;
    border-radius: 0 !important;
  }

  .modal-heading {
    position: sticky;
    z-index: 4;
    top: -16px;
    margin: -16px -16px 12px;
    padding: 14px 16px 12px;
    background: var(--bg-1);
  }

  .modal-actions {
    position: sticky;
    z-index: 4;
    bottom: -16px;
    margin: 16px -16px -16px;
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--bg-1);
  }

  .server-profile-editor-grid {
    grid-template-columns: 1fr !important;
    gap: 18px;
  }

  .server-profile-fields {
    padding-right: 0;
    padding-bottom: 18px;
    border-right: 0;
    border-bottom: 1px solid rgba(148,163,184,.10);
  }

  .profile-section-editor-head {
    grid-template-columns: minmax(0,1fr) 34px !important;
  }

  .profile-section-editor-head select {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .profile-item-editor {
    grid-template-columns: 40px minmax(0,1fr) 34px !important;
  }

  .profile-item-editor > .file-picker,
  .profile-item-editor > input[type="file"] + .file-picker {
    grid-column: 2 / -1;
  }

  .profile-color-grid,
  .upload-grid {
    grid-template-columns: 1fr !important;
  }

  .file-picker {
    grid-template-columns: minmax(118px,auto) minmax(0,1fr);
  }

  .account-setting-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .account-public-id-row {
    grid-column: 1;
  }

  .profile-popout {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto !important;
    max-height: min(74dvh, 680px);
  }

  .call-stage {
    padding: 10px;
  }

  .call-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(190px, auto);
  }

  .call-controls {
    overflow-x: auto;
    justify-content: flex-start;
  }

  /* Staff panel */
  dialog.staff-modal {
    width: 100vw !important;
    height: 100dvh !important;
    max-height: none !important;
    margin: 0;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  .staff-shell {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto minmax(0,1fr);
  }

  .staff-nav {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .staff-nav-brand {
    min-height: 0;
    padding: 0;
    border-bottom: 0;
  }

  .staff-nav-brand > div {
    display: none;
  }

  .staff-nav-mark {
    width: 34px;
    height: 34px;
  }

  .staff-nav nav {
    min-width: 0;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 0;
    scrollbar-width: none;
  }

  .staff-nav nav::-webkit-scrollbar {
    display: none;
  }

  .staff-tab {
    min-height: 34px;
    flex: 0 0 auto;
    padding: 7px 9px;
    white-space: nowrap;
  }

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

  .staff-close {
    width: 34px;
    min-height: 34px;
    margin: 0;
    padding: 0;
    justify-content: center;
  }

  .staff-close span {
    display: none;
  }

  .staff-workspace-header {
    min-height: 64px;
    padding: 13px 14px 11px;
  }

  .staff-workspace-header h2 {
    font-size: 19px;
  }

  .staff-content {
    padding: 12px 12px 24px;
  }

  .staff-stat-grid {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  }

  .staff-review-form,
  .staff-create-badge,
  .staff-award-form {
    grid-template-columns: 1fr !important;
  }

  .staff-detail-grid {
    grid-template-columns: 1fr !important;
  }

  .staff-community-tool-form {
    grid-template-columns: 1fr;
  }

  .staff-community-tool-form > button {
    width: 100%;
  }

  .staff-danger-zone,
  .staff-action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .staff-action-row input,
  .staff-action-row select {
    min-width: 0;
    width: 100%;
  }

  .achievement-grid {
    grid-template-columns: 1fr;
  }

  .app-context-menu {
    width: min(250px, calc(100vw - 16px));
  }
}

@media (max-width: 420px) {
  .app-shell,
  .app-shell.home-mode {
    grid-template-columns: 52px minmax(0,1fr) !important;
  }

  .community-rail {
    width: 52px;
    padding-inline: 5px;
  }

  .channel-sidebar {
    left: 52px !important;
    width: calc(100vw - 52px) !important;
  }

  .member-sidebar {
    width: calc(100vw - 52px) !important;
  }

  .community-button,
  .rail-action {
    width: 38px;
    height: 38px;
    min-height: 38px;
  }

  .channel-header-icon {
    display: none;
  }

  .content-header {
    padding-inline: 6px;
  }

  .staff-stat-grid {
    grid-template-columns: 1fr !important;
  }

  .add-friend-form {
    flex-direction: column;
  }
}

.staff-award-actions {
  display: flex;
  gap: 7px;
}
.staff-award-actions > button {
  min-height: 40px;
  flex: 1;
  white-space: nowrap;
}

.account-profile-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}
.account-profile-card > div:first-child {
  margin-bottom: 2px;
}
.account-profile-card h3 {
  margin: 0 0 4px;
  font-size: 14px;
}
.account-profile-card p { margin: 0; }

/* Floating hover tooltips keep badge labels outside scroll clipping. */
.profile-popout .profile-badge::after {
  content: none !important;
}
.relay-hover-tooltip {
  position: fixed;
  z-index: 320;
  max-width: min(240px, calc(100vw - 16px));
  padding: 6px 8px;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 6px;
  background: var(--surface-rail);
  color: #eef2f8;
  box-shadow: 0 10px 28px rgba(0,0,0,.46);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
}

/* Roles shown directly on member profiles */
.profile-role-list-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 7px 0 2px;
}
.profile-role-list {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.profile-role-chip {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb,var(--profile-text) 12%,transparent);
  border-radius: 6px;
  background: color-mix(in srgb,var(--profile-text) 6%,transparent);
  color: var(--profile-text);
  font-size: 9px;
  font-weight: 750;
}
.profile-role-chip img {
  width: 13px;
  height: 13px;
  object-fit: contain;
}
.profile-manage-roles {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0 !important;
  border: 1px solid color-mix(in srgb,var(--profile-accent) 32%,transparent);
  border-radius: 6px;
  background: color-mix(in srgb,var(--profile-accent) 12%,transparent) !important;
  box-shadow: none !important;
  color: var(--profile-text);
  font-size: 15px;
}
.member-role-options {
  max-height: 430px;
  display: grid;
  gap: 6px;
  overflow-y: auto;
  margin-top: 12px;
}
.member-role-option {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-1);
}
.member-role-option > input { width: auto; margin: 0; }
.member-role-option-visual {
  display: flex;
  align-items: center;
  gap: 7px;
}
.member-role-option-visual img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.message-role-icon {
  width: 15px;
  height: 15px;
  margin-left: -2px;
  object-fit: contain;
  flex: 0 0 auto;
}

/* Focused channel settings */
.channel-settings-content {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.channel-settings-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-1);
}
.channel-settings-section h3 {
  margin: 0 0 12px;
  font-size: 14px;
}
.channel-settings-section-heading {
  margin-bottom: 12px;
}
.channel-settings-sync-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.channel-sync-state { margin-left: auto; color: var(--muted); font-size: 10px; }
.channel-sync-permissions {
  min-height: 40px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid color-mix(in srgb,var(--accent) 68%,white 12%);
  border-radius: 8px;
  background: color-mix(in srgb,var(--accent) 22%,var(--surface-input)) !important;
  color: var(--text) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--accent) 10%,transparent);
  font-size: 11px;
  font-weight: 800;
}
.channel-sync-permissions:hover:not(:disabled) {
  background: color-mix(in srgb,var(--accent) 34%,var(--surface-input)) !important;
}
.channel-settings-section-heading h3 { margin-bottom: 3px; }
.channel-settings-section-heading p { margin: 0; }
.channel-role-overrides {
  display: grid;
  gap: 8px;
}
.channel-role-override {
  display: grid;
  grid-template-columns: minmax(140px, .45fr) minmax(0,1.55fr);
  gap: 12px;
  align-items: start;
  padding: 11px;
  border: 1px solid rgba(148,163,184,.10);
  border-radius: 9px;
  background: var(--bg-1);
}
.channel-role-identity {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.channel-role-identity img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}
.channel-role-permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(118px,1fr));
  gap: 8px;
}
.channel-role-permission-grid label {
  margin: 0;
  font-size: 9px;
}
.channel-permission-select {
  min-height: 34px !important;
  margin-top: 4px;
  font-size: 10px;
}

/* Community platform marks */
.community-title-line {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 7px;
}
.community-title-line strong { min-width: 0; overflow-wrap: anywhere; }
.community-status-marks {
  display: inline-flex;
  gap: 7px;
  flex: 0 0 100%;
  min-height: 17px;
}
.community-status-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  filter: invert(1);
}
.community-status-icon.official { filter: invert(76%) sepia(80%) saturate(600%); }
.community-button { position: relative; }
.community-activity-badges { position: absolute; top: -3px; right: -3px; display: flex; align-items: center; gap: 2px; padding: 2px; border: 2px solid var(--surface-rail); border-radius: 8px; background: var(--surface-rail); }
.community-ping-dot { min-width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; border: 1px solid var(--surface-rail); border-radius: 999px; background: #d6293e; color: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4); font-size: 9px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.community-unread-dot { width: 8px; height: 8px; display: block; border-radius: 50%; }
.community-unread-dot { background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.channel-unread-dot { width: 7px; height: 7px; flex: 0 0 7px; margin-left: auto; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.45); }
.channel-ping-count { min-width: 17px; height: 17px; display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; margin-left: auto; padding: 0 4px; border-radius: 999px; background: #d6293e; color: #fff; font-size: 9px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.rail-community-status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  filter: invert(1);
}

/* Server Navigator */
.app-shell.navigator-mode {
  grid-template-columns: 72px minmax(0,1fr) !important;
}
.app-shell.navigator-mode .channel-sidebar,
.app-shell.navigator-mode .member-sidebar {
  display: none !important;
}
.app-shell.navigator-mode .content-pane {
  grid-column: 2 !important;
}
.navigator-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px clamp(18px,4vw,54px) 54px;
}
.navigator-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0 22px;
}
.navigator-hero h1 {
  margin: 3px 0 5px;
  font-size: clamp(25px,3vw,38px);
  letter-spacing: -.035em;
}
.navigator-hero p { margin: 0; }
.navigator-search-form {
  min-width: min(420px, 42vw);
  display: grid;
  grid-template-columns: 20px minmax(0,1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 5px 5px 5px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-1);
}
.navigator-search-form input {
  min-height: 38px;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none !important;
}
.navigator-search-form button { min-height: 38px; }
.navigator-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
}
.navigator-tag {
  min-height: 29px;
  padding: 5px 10px !important;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2) !important;
  color: #9dacbf;
  box-shadow: none !important;
  font-size: 10px;
}
.navigator-tag:hover,
.navigator-tag.active {
  border-color: color-mix(in srgb,var(--accent) 42%,transparent);
  background: color-mix(in srgb,var(--accent) 13%,var(--bg-2)) !important;
  color: #eef3fb;
  filter: none !important;
}
.navigator-content {
  display: grid;
  gap: 30px;
}
.navigator-section-head {
  margin-bottom: 10px;
}
.navigator-section-head h2 {
  margin: 0 0 3px;
  font-size: 17px;
}
.navigator-section-head p { margin: 0; }
.navigator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(260px,1fr));
  gap: 12px;
}
.navigator-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg-1);
  box-shadow: 0 12px 30px rgba(0,0,0,.13);
}
.navigator-card-featured {
  border-color: color-mix(in srgb,var(--accent) 45%,transparent);
  box-shadow: 0 18px 48px color-mix(in srgb,var(--accent) 8%,rgba(0,0,0,.22));
}
.navigator-card-banner {
  height: 90px;
  background-size: cover;
  background-position: center;
}
.navigator-card-body {
  padding: 12px;
}
.navigator-card-top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: -26px;
}
.navigator-card-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 48px;
  border: 4px solid var(--bg-1);
  border-radius: 14px;
  background: var(--bg-4);
  color: white;
  font-size: 13px;
  font-weight: 850;
}
.navigator-card-icon img { width: 100%; height: 100%; object-fit: cover; }
.navigator-card-identity {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding-top: 20px;
}
.navigator-card-identity strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.navigator-card-identity span {
  color: #6f7d91;
  font-size: 9px;
}
.navigator-card-statuses,
.staff-community-status-row,
.community-platform-status {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}
.navigator-status,
.platform-status-pill {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: #b7c2d2;
  font-size: 8px;
  font-weight: 850;
}
.navigator-status img {
  width: 11px;
  height: 11px;
  filter: invert(1);
}
.navigator-status-official,
.platform-status-pill.official {
  border-color: rgba(245,190,70,.30);
  color: #f5c963;
}
.navigator-status-partner,
.platform-status-pill.partner {
  border-color: rgba(110,168,255,.28);
  color: #8db9ff;
}
.navigator-status-verified,
.platform-status-pill.verified {
  border-color: rgba(80,190,255,.28);
  color: #7bd0ff;
}
.navigator-status-sponsored,
.platform-status-pill.sponsored {
  border-color: rgba(186,124,255,.28);
  color: #c397ff;
}
.platform-status-pill.discoverable { color: #81d9b1; }
.navigator-card-description {
  min-height: 38px;
  margin: 10px 0 8px;
  color: #96a4b6;
  font-size: 10px;
  line-height: 1.45;
}
.navigator-card-tags {
  min-height: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.navigator-card-tags .navigator-tag {
  min-height: 23px;
  padding: 3px 7px !important;
  font-size: 8px;
}
.navigator-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.navigator-card-actions button {
  min-height: 34px;
  font-size: 10px;
}
.navigator-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: #748297;
  text-align: center;
}
.navigator-empty strong { color: #c6d0dd; }

/* Staff discovery controls */
.staff-community-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 9px;
}
.staff-community-tags span {
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--bg-2);
  color: #8795aa;
  font-size: 8px;
}
.staff-discovery-form {
  display: grid;
  grid-template-columns: auto auto 120px minmax(140px,1fr) auto;
  align-items: end;
  gap: 9px;
  margin-top: 12px;
  padding: 11px;
  border: 1px solid rgba(148,163,184,.10);
  border-radius: 9px;
  background: var(--bg-1);
}
.staff-discovery-form label { margin: 0; font-size: 9px; }
.staff-discovery-form .switch-row {
  min-height: 38px;
}
.staff-discovery-form button { min-height: 38px; }

@media (max-width: 760px) {
  .app-shell.navigator-mode {
    grid-template-columns: 52px minmax(0,1fr) !important;
  }
  .app-shell.navigator-mode .content-pane { grid-column: 2 !important; }
  .navigator-view { padding: 14px 10px 30px; }
  .navigator-hero {
    align-items: stretch;
    flex-direction: column;
    padding-top: 5px;
  }
  .navigator-search-form {
    min-width: 0;
    width: 100%;
  }
  .navigator-grid { grid-template-columns: 1fr; }
  .channel-role-override {
    grid-template-columns: 1fr;
  }
  .channel-role-permission-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  .staff-discovery-form {
    grid-template-columns: 1fr;
  }
}

/* Auth, security, custom color picker, Topics and Displays */
.auth-card {
  width: min(500px,100%);
  padding: 30px;
}
.auth-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-brand-row h1 { margin: 0 0 3px; }
.auth-brand-row p { margin: 0; }
.auth-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 24px 0 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-rail);
}
.auth-mode-tab {
  min-height: 36px;
  border-radius: 7px;
  background: transparent !important;
  color: #7f8ca0;
  box-shadow: none !important;
}
.auth-mode-tab.active {
  background: var(--bg-3) !important;
  color: #f6f8fb;
}
.auth-register-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
.auth-register-fields > label:first-child,
.auth-register-fields > label:nth-child(2) {
  grid-column: span 1;
}
.auth-register-fields > label:nth-child(3),
.auth-register-fields > label:nth-child(4) {
  grid-column: span 1;
}
.auth-submit-button {
  width: 100%;
  min-height: 42px;
  margin-top: 5px;
}
.optional-label {
  color: #66758a;
  font-size: 9px;
  font-weight: 600;
}

.native-color-input { display: none !important; }
.color-picker-trigger {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px !important;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-1) !important;
  color: #abb7c8;
  box-shadow: none !important;
  text-align: left;
}
.color-picker-trigger-swatch {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 2px solid rgba(255,255,255,.16);
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.24);
}
.color-picker-trigger-value {
  font-family: ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size: 10px;
  letter-spacing: .02em;
}
.color-picker-dialog { width: min(470px,calc(100vw - 24px)) !important; }
.relay-color-picker {
  display: grid;
  grid-template-columns: 120px minmax(0,1fr);
  gap: 18px;
  margin-top: 16px;
}
.color-picker-preview {
  min-height: 150px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.24);
}
.color-picker-controls {
  display: grid;
  gap: 9px;
}
.color-picker-controls label {
  margin: 0;
  font-size: 10px;
}
.color-picker-controls input[type="range"] {
  min-height: 18px !important;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  appearance: none;
}
.color-picker-controls input[type="range"]::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--bg-2);
  appearance: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
#color-picker-hue {
  background: linear-gradient(90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00);
}
.color-picker-presets {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(8,1fr);
  gap: 7px;
}
.color-picker-preset {
  aspect-ratio: 1;
  min-height: 0 !important;
  padding: 0 !important;
  border: 2px solid rgba(255,255,255,.11);
  border-radius: 7px;
  box-shadow: none !important;
}

.server-profile-modal {
  width: min(760px,calc(100vw - 34px)) !important;
}
.server-profile-simple-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  margin-top: 18px;
}
.server-profile-simple-grid > label {
  margin-top: 14px;
}
.server-profile-media,
.server-profile-bio,
.server-profile-simple-grid > .profile-color-grid,
.server-profile-simple-grid > .switch-row {
  grid-column: 1 / -1;
}
.server-profile-bio textarea {
  min-height: 150px;
}
.server-profile-simple-grid .profile-color-grid {
  margin-top: 14px;
}
.server-profile-simple-grid .switch-row {
  margin-top: 15px;
}

/* Topic-grouped sidebar + editable Displays */
.sidebar-display-list {
  display: grid;
  gap: 4px;
  margin: 1px 0 14px;
  padding: 0 3px 10px;
  border-bottom: 1px solid rgba(148,163,184,.08);
}
.sidebar-display {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(148,163,184,.045);
  color: #7f8da1;
  font-size: 10px;
}
.sidebar-display strong {
  color: #c3cedd;
  font-size: 11px;
}
.channel-topic-heading {
  margin: 17px 7px 5px;
  color: #6e7c91;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.channel-topic-empty {
  padding: 5px 10px 8px;
  color: #4d5b6f;
  font-size: 9px;
}
.settings-stack {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.settings-inline-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  gap: 8px;
  align-items: center;
}
.settings-create-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(148,163,184,.09);
}
.display-settings-row {
  display: grid;
  grid-template-columns: 110px minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-1);
}
.display-settings-live {
  display: grid;
  gap: 2px;
}
.display-settings-live strong {
  color: #eef3f9;
  font-size: 22px;
}
.display-settings-live span {
  color: #6e7c90;
  font-size: 9px;
}
.display-settings-fields {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 9px;
  align-items: center;
}
.display-settings-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}
.compact-switch { margin: 0 !important; }

/* Chat role identity and clipping fixes */
.message {
  align-items: start;
  padding-top: 7px;
  padding-bottom: 7px;
}
.message-body {
  min-width: 0;
  padding-top: 1px;
}
.message-meta {
  min-height: 18px;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}
.message-name {
  line-height: 1.25;
  overflow: visible;
}
.message-role-icon {
  width: 14px;
  height: 14px;
  margin: 0 1px 0 0;
  vertical-align: middle;
}
.message-time {
  line-height: 1.25;
}
.message-content {
  margin-top: 1px;
  padding-bottom: 1px;
  line-height: 1.52;
  overflow: visible;
}
.composer input {
  line-height: 1.4;
}

/* Account security */
.account-identity-card,
.account-security-card { grid-column: 1 / -1; }
.account-security-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}
.security-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid rgba(148,163,184,.15);
  border-radius: 999px;
  background: var(--bg-2);
  color: #8290a3;
  font-size: 9px;
  font-weight: 800;
}
.security-status-pill.enabled {
  border-color: rgba(52,211,153,.28);
  color: #67d7a1;
}
.account-security-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}
.two-factor-setup-dialog { width: min(650px,calc(100vw - 28px)) !important; }
.two-factor-setup-grid {
  display: grid;
  grid-template-columns: 250px minmax(0,1fr);
  gap: 18px;
  align-items: center;
  margin: 18px 0;
}
.two-factor-qr-wrap {
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 12px;
  background: white;
}
.two-factor-qr-wrap img {
  width: 230px;
  max-width: 100%;
  display: block;
}
.two-factor-secret-wrap {
  display: grid;
  gap: 9px;
}
.two-factor-secret-wrap > span {
  color: #7f8da1;
  font-size: 10px;
}
.two-factor-secret-wrap code {
  overflow-wrap: anywhere;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-1);
  color: #d8e1ed;
  font-size: 11px;
}
.recovery-codes-dialog { width: min(520px,calc(100vw - 28px)) !important; }
.recovery-code-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 18px 0;
}
.recovery-code-list code {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-1);
  color: #d8e1ed;
  font-size: 11px;
  text-align: center;
}

@media (max-width: 760px) {
  .auth-card {
    width: 100%;
    padding: 20px 16px;
  }
  .auth-register-fields { grid-template-columns: 1fr; }
  .auth-register-fields > label { grid-column: 1 !important; }

  .server-profile-modal {
    width: 100vw !important;
    max-width: none !important;
    min-height: 100dvh;
    margin: 0;
    border-radius: 0 !important;
  }
  .server-profile-simple-grid {
    grid-template-columns: 1fr;
  }
  .server-profile-media,
  .server-profile-bio,
  .server-profile-simple-grid > .profile-color-grid,
  .server-profile-simple-grid > .switch-row {
    grid-column: 1;
  }
  .profile-color-grid { grid-template-columns: 1fr; }

  .relay-color-picker { grid-template-columns: 1fr; }
  .color-picker-preview { min-height: 90px; }
  .color-picker-presets { grid-template-columns: repeat(8,1fr); }

  .settings-inline-row,
  .display-settings-row,
  .display-settings-fields {
    grid-template-columns: 1fr;
  }
  .display-settings-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .two-factor-setup-grid { grid-template-columns: 1fr; }
  .two-factor-qr-wrap { width: min(250px,100%); margin: auto; }
  .recovery-code-list { grid-template-columns: 1fr; }
  .account-security-status {
    align-items: flex-start;
    flex-direction: column;
  }
  .account-security-actions { justify-content: flex-start; }
}

/* Flexible sidebar controls and topic sorting */
.user-dock { min-width: 0; }
.user-dock > .icon-button { width: 30px; min-width: 30px; height: 32px; padding: 6px; flex: 0 0 30px; }
.user-dock > .icon-button .ui-icon { width: 18px; height: 18px; }
.user-summary { overflow: hidden; }
.topic-section-heading { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 9px; }
.topic-section-heading .mini-button { display: grid; place-items: center; flex: 0 0 24px; }
.channel-topic-heading { padding: 5px 7px; margin-left: 0; margin-right: 0; border-radius: 6px; overflow-wrap: anywhere; }
.channel-topic-heading[draggable="true"] { cursor: grab; }
.channel-topic-heading[draggable="true"]:active { cursor: grabbing; }
.channel-topic-group.dragging { opacity: .48; }
.channel-topic-group.drop-target .channel-topic-heading { outline: 2px solid var(--accent); background: var(--accent-soft); color: #eee; }

/* Uploads and discovery at narrow widths */
.community-create-fields .file-picker, .server-profile-media .file-picker {
  align-items: stretch; flex-direction: column; gap: 5px;
}
.community-create-fields .file-picker-button, .server-profile-media .file-picker-button {
  min-width: 0; width: 100%; white-space: normal;
}
.community-create-fields .file-picker-name, .server-profile-media .file-picker-name {
  flex: 0 0 auto; width: 100%; white-space: normal; overflow-wrap: anywhere;
}
.navigator-grid { grid-template-columns: repeat(auto-fill,minmax(min(100%,290px),1fr)); }
.navigator-card-identity span, .navigator-status, .platform-status-pill,
.navigator-card-tags .navigator-tag { font-size: 10px; }
.navigator-card-description { font-size: 12px; }
.navigator-card-tags { min-height: 0; }

@media (max-width: 720px) {
  .community-create-modal { width: min(100vw - 20px,520px) !important; }
  .community-create-grid { grid-template-columns: 1fr; }
  .community-create-preview { min-height: 170px; padding-top: 99px; }
  .navigator-hero { flex-direction: column; align-items: stretch; }
  .navigator-search-form { width: 100%; }
  .navigator-view { padding: 16px 14px 48px; }
  .navigator-grid { grid-template-columns: repeat(auto-fill,minmax(min(100%,250px),1fr)); }
}

/* Message links and community invite previews */
.message-content { overflow-wrap: anywhere; white-space: pre-wrap; }
.message-content a { color: #9ab8ff; text-decoration: underline; text-underline-offset: 2px; }
.message-mention {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(137,166,202,.12);
  color: #b8cce4;
  font-weight: 800;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.message-mention-group { background: rgba(137,166,202,.12); }
.message-mention-role { background: rgba(137,166,202,.12); color: #b8cce4; }
.message-mention-link { display: inline; min-height: 0; margin: 0; padding: 1px 4px; border: 0; border-radius: 4px; background: rgba(137,166,202,.12); color: #b8cce4; font: inherit; font-weight: 800; line-height: inherit; cursor: pointer; }
.message-mention-link:hover { background: rgba(137,166,202,.2); filter: none; }
.message.message-mentioned-viewer {
  border-left: 3px solid #edc65b;
  background: rgba(245,190,70,.11);
}
.message-mentioned-viewer .message-mention,
.message-mentioned-viewer .message-mention-link,
.message-mentioned-viewer .message-mention-group,
.message-mentioned-viewer .message-mention-role {
  background: rgba(245,190,70,.28);
  color: #ffe27a;
}
.mention-suggestion-heading {
  padding: 7px 9px 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.message-link-preview { display: block; max-width: 440px; overflow: hidden; margin: 7px 0 2px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: var(--bg-1);
  color: var(--text); text-decoration: none !important; }
.message-link-preview:hover { border-color: var(--accent); }
.message-link-preview-banner { height: 105px; background-size: cover; background-position: center; }
.message-link-preview-body { display: grid; gap: 4px; padding: 11px 13px; }
.message-link-preview-site { color: #94a3b8; font-size: 10px; font-weight: 800; }
.message-link-preview-body strong { font-size: 14px; }
.message-link-preview-body span:last-child { color: #a7b3c3; font-size: 11px; line-height: 1.4; }

.message-link-preview-banner img { width: 100%; height: 100%; display: block; object-fit: cover; }
.contact-verification-list { display: grid; gap: 8px; margin: 12px 0 3px; }
.contact-verification-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  padding: 8px; border: 1px solid var(--line); border-radius: 8px;
}
.contact-verification-row > span { min-width: 0; flex: 1 1 130px; color: var(--muted); font-size: 11px; }
.contact-verification-status { color: #f6bc72; }
.contact-verification-status.verified { color: #6fdaa5; }
.contact-verification-row button { min-height: 30px; padding: 5px 9px; font-size: 10px; }
.contact-verification-row .contact-code { width: 120px !important; min-height: 32px !important; }

/* Keep profile details and badges legible at normal scaling. */
.profile-popout { width: min(350px, calc(100vw - 20px)); }
.profile-body { padding-left: 14px; padding-right: 14px; }
.profile-handle, .profile-bio, .profile-role-line { font-size: 11px; }
.profile-flair { width: 32px; min-height: 32px; }
.profile-flair img { width: 18px; height: 18px; }
.profile-badge { min-height: 28px; font-size: 10px; }
.profile-badge-icon { width: 16px; height: 16px; }

/* Sidebar organization */
.sidebar-create-wrap { position: relative; }
.sidebar-create-menu { position: absolute; top: 28px; right: 0; z-index: 40; width: 174px; display: grid; gap: 2px; padding: 5px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--bg-2); box-shadow: 0 12px 32px rgba(0,0,0,.4); }
.sidebar-create-menu button { width: 100%; min-height: 32px; padding: 7px 10px; border-radius: 5px; background: transparent; color: #dce5f0; font-size: 12px; font-weight: 600; text-align: left; text-transform: none; letter-spacing: 0; }
.sidebar-create-menu button:hover, .sidebar-create-menu button:focus-visible { background: var(--bg-4); }
.channel-button[draggable="true"], .channel-topic-heading[draggable="true"] { cursor: grab; }
.channel-button.dragging, .channel-topic-group.dragging { opacity: .48; }
.channel-topic-group.drop-target { outline: 1px solid #8b7be4; outline-offset: -2px; border-radius: 6px; background: rgba(139,123,228,.09); }
.channel-topic-heading { font-size: 11px; letter-spacing: .04em; }
.channel-topic-empty { font-size: 11px; }

/* Settings and creation workspaces */
#community-dialog, #channel-dialog, #profile-dialog, #account-settings-dialog { width: min(880px,calc(100vw - 28px)) !important; }
#channel-settings-dialog { width: min(940px,calc(100vw - 28px)) !important; }
#settings-dialog { width: min(980px,calc(100vw - 28px)) !important; }
.editor-shell { display: grid; grid-template-columns: 158px minmax(0,1fr); min-height: 350px; margin-top: 18px; border-top: 1px solid var(--line); }
.editor-nav { display: flex; flex-direction: column; gap: 3px; padding: 16px 12px 16px 0; border-right: 1px solid var(--line); }
.editor-nav button { width: 100%; min-height: 34px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: #a9b7c9; font-size: 12px; font-weight: 600; text-align: left; box-shadow: none; }
.editor-nav button:hover, .editor-nav button:focus-visible { background: var(--bg-3); color: #fff; }
.editor-nav button.active { background: var(--bg-4); color: #f6f8fc; }
.editor-main { min-width: 0; max-height: min(58vh,560px); overflow-y: auto; padding: 18px 0 20px 22px; }
.editor-main [data-editor-panel]:not(.active) { display: none !important; }
.editor-panel h3, .editor-main > .settings-card h3 { margin: 0 0 5px; font-size: 15px; }
.editor-panel > .subtle { margin: 0 0 19px; font-size: 12px; }
.editor-main label { font-size: 12px; line-height: 1.45; }
.editor-main input, .editor-main select, .editor-main textarea { font-size: 13px; }
.editor-main .settings-field-row { gap: 12px; }
#community-dialog .community-create-preview { min-height: 200px; margin: 0 0 18px; padding-top: 105px; }
#channel-settings-dialog .channel-settings-content { display: block; margin-top: 0; }
#channel-settings-dialog .channel-settings-section { margin: 0; padding: 0; border: 0; background: transparent; }
#channel-settings-dialog .channel-settings-section + .channel-settings-section { margin-top: 0; }
#account-settings-dialog .account-settings-grid { display: block; margin-top: 0; }
#account-settings-dialog .account-settings-grid > .settings-card { display: block; margin: 0; padding: 0; border: 0; background: transparent; }
#account-settings-dialog .account-settings-grid > .settings-card > div:first-child p { margin: 5px 0 17px; }
#account-settings-dialog .account-security-status { justify-content: flex-start; }
#account-settings-dialog input:-webkit-autofill { -webkit-text-fill-color: #eef3f9; box-shadow: 0 0 0 1000px var(--bg-1) inset !important; caret-color: #eef3f9; }
.contact-verification-row .contact-delivery-note { flex-basis: 100%; margin: 0; color: #97a7ba; font-size: 11px; line-height: 1.4; }

.settings-dialog-layout { display: grid; grid-template-columns: 168px minmax(0,1fr); min-height: 480px; margin: 18px 20px 0; border-top: 1px solid var(--line); }
.settings-dialog-layout .settings-tabs { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 0; margin: 0; padding: 16px 12px 16px 0; border: 0; border-right: 1px solid var(--line); }
.settings-dialog-layout .settings-tab { min-height: 34px; width: 100%; padding: 8px 10px; border-radius: 6px; font-size: 12px; text-align: left; }
.settings-dialog-layout .settings-tab.active { background: var(--bg-4); }
.settings-dialog-layout .settings-content { min-width: 0; max-height: min(67vh,620px); overflow-y: auto; padding: 16px 0 22px 22px; }
@media (max-width: 680px) {
  .editor-shell, .settings-dialog-layout { grid-template-columns: minmax(0,1fr); min-height: 0; }
  .editor-nav, .settings-dialog-layout .settings-tabs { flex-direction: row; overflow-x: auto; padding: 9px 0; border: 0; border-bottom: 1px solid var(--line); }
  .editor-nav button, .settings-dialog-layout .settings-tab { width: auto; flex: 0 0 auto; white-space: nowrap; }
  .editor-main, .settings-dialog-layout .settings-content { max-height: min(56vh,520px); padding: 16px 0; }
  .settings-dialog-layout { margin: 18px 20px 0; }
}

/* Give contact fields and upload names room to breathe. */
#account-settings-dialog .account-identity-card .settings-field-row,
#channel-dialog .settings-field-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
.editor-main .upload-grid label { min-width: 0; }
.editor-main .file-picker { min-width: 0; flex-wrap: wrap; gap: 6px; }
.editor-main .file-picker-button { min-width: 0; white-space: normal; }
.editor-main .file-picker-name { min-width: 95px; overflow-wrap: anywhere; text-overflow: clip; white-space: normal; }
.create-channel-form { display: grid; gap: 14px; padding: 16px 0 6px; }
.create-channel-form > label, .create-channel-form .settings-field-row > label { display: grid; gap: 6px; color: var(--text-soft); font-size: 12px; font-weight: 700; }
.create-channel-form .settings-field-row { align-items: end; }
.create-channel-form textarea { min-height: 70px; }
.create-topic-select-row { display: flex; align-items: center; gap: 7px; }
.create-topic-select-row select { min-width: 0; flex: 1; }
.create-topic-select-row button { min-height: 38px; flex: 0 0 auto; padding: 7px 10px; }
.create-advanced-options { border-top: 1px solid var(--line); padding-top: 11px; }
.create-advanced-options summary, .role-create-customize summary { color: var(--text-soft); font-size: 12px; font-weight: 700; cursor: pointer; }
.create-advanced-fields { display: grid; gap: 10px; padding: 12px 2px 3px; }
.create-advanced-fields > label:first-child { display: grid; gap: 6px; color: var(--text-soft); font-size: 12px; }
.role-create-intro { display: grid; gap: 10px; }
.role-create-intro > label { display: grid; gap: 6px; color: var(--text-soft); font-size: 12px; font-weight: 700; }
.role-template-help { margin: -3px 0 2px; }
.role-create-customize { border-top: 1px solid var(--line); padding-top: 11px; }
.role-create-custom-fields { display: grid; gap: 10px; padding: 12px 2px 4px; }
.role-create-custom-fields > label:first-child { display: grid; gap: 6px; color: var(--text-soft); font-size: 12px; }
.role-create-permissions { padding-top: 10px; }
.role-create-permissions h4 { margin: 0 0 4px; font-size: 12px; }
.role-create-permissions > .subtle { margin: 0 0 10px; }
.role-create-permissions .permission-groups { gap: 8px; }
.role-create-permissions .permission-group { padding: 9px; }
@media (max-width: 560px) {
  #account-settings-dialog .account-identity-card .settings-field-row,
  #channel-dialog .settings-field-row, .create-channel-form .settings-field-row, .editor-main .upload-grid,
  .editor-main .profile-color-grid { grid-template-columns: minmax(0,1fr); }
  .create-topic-select-row { align-items: stretch; flex-direction: column; }
}

/* Server rail + Navigator scaling cleanup */
.community-rail > .rail-action { margin-top: 0; }
#create-community-button {
  margin-top: 0;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  cursor: pointer;
  background: #1c1730;
  border-color: rgba(167,139,250,.28);
}
#create-community-button .ui-icon { width: 22px; height: 22px; flex: 0 0 22px; }
#create-community-button:hover { background: #30204e; border-color: var(--accent); }
.achievement-card > div { flex: 1; }
.achievement-delete { margin-left: auto; min-height: 30px; padding: 5px 9px; font-size: 10px; }

.navigator-rail-button {
  display: grid;
  place-items: center;
  overflow: visible;
  background: var(--bg-2) !important;
  border-color: rgba(148,163,184,.14);
}
.navigator-rail-button .ui-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  opacity: .9;
}
.navigator-rail-button:hover,
.navigator-rail-button.active {
  border-color: color-mix(in srgb,var(--accent) 44%,transparent);
  background: color-mix(in srgb,var(--accent) 15%,var(--bg-2)) !important;
}
.community-button {
  isolation: isolate;
}
.community-button > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rail-community-status { display: none !important; }

.navigator-grid {
  grid-template-columns: repeat(auto-fit,minmax(280px,1fr));
  align-items: stretch;
}
.navigator-card {
  min-width: 0;
  display: grid;
  grid-template-rows: 104px 1fr;
}
.navigator-card-banner {
  height: 104px;
  min-height: 104px;
}
.navigator-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 14px;
}
.navigator-card-top {
  min-width: 0;
  align-items: flex-end;
  margin-top: -38px;
}
.navigator-card-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-width: 4px;
  border-radius: 16px;
  font-size: 15px;
}
.navigator-card-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.navigator-card-identity {
  min-width: 0;
  padding: 0 0 5px;
}
.navigator-card-identity strong {
  display: block;
  max-width: 100%;
  font-size: 14px;
}
.navigator-card-statuses {
  min-height: 27px;
  align-items: center;
}
.navigator-status {
  min-height: 25px;
  padding: 4px 8px;
  gap: 5px;
  font-size: 9px;
}
.navigator-status img {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
}
.navigator-card-description {
  min-height: 42px;
  font-size: 11px;
}
.navigator-card-tags { flex: 1 0 auto; }
.navigator-card-actions { margin-top: 13px; }

@media (max-width: 900px) {
  .navigator-grid {
    grid-template-columns: repeat(auto-fit,minmax(240px,1fr));
  }
}
@media (max-width: 600px) {
  .navigator-grid { grid-template-columns: 1fr; }
  .navigator-card {
    grid-template-rows: 92px 1fr;
  }
  .navigator-card-banner {
    height: 92px;
    min-height: 92px;
  }
  .navigator-card-icon {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }
}

/* Verified-email communication gate */
.communication-verification-banner {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 10px 14px 0;
  padding: 10px 12px;
  border: 1px solid rgba(245,158,11,.24);
  border-radius: 10px;
  background:
    linear-gradient(90deg,color-mix(in srgb,var(--accent) 9%,transparent),color-mix(in srgb,var(--accent-2) 5%,transparent)),
    var(--bg-1);
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
.communication-verification-banner > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.communication-verification-banner strong {
  color: #f2d08a;
  font-size: 11px;
}
.communication-verification-banner span {
  color: #8e9bad;
  font-size: 10px;
  line-height: 1.35;
}
.communication-verification-banner button {
  min-height: 32px;
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 10px;
}
#composer .send-button:disabled,
#message-input:disabled {
  cursor: not-allowed;
  opacity: .55;
}
@media (max-width: 620px) {
  .communication-verification-banner {
    align-items: stretch;
    flex-direction: column;
    margin: 8px 9px 0;
  }
  .communication-verification-banner button { width: 100%; }
}

/* Relay welcome and public pages */
.landing-view { height: 100dvh; overflow-y: auto; background: var(--surface-rail); color: #f6f4f4; }
.landing-view a, .legal-page a { color: inherit; text-decoration: none; }
.landing-nav, .landing-footer { width: min(1220px,calc(100% - 48px)); margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.landing-nav { min-height: 74px; border-bottom: 1px solid #ffffff18; }
.landing-brand { display: inline-flex; align-items: center; gap: 11px; font-size: 20px; letter-spacing: -.04em; }
.landing-brand img { width: 42px; height: 42px; object-fit: contain; }
.landing-nav-links, .landing-footer > div { display: flex; align-items: center; gap: clamp(14px,3vw,40px); color: #bcb6b7; font-size: 13px; }
.landing-nav-links { flex: 1; justify-content: center; gap: clamp(18px,2.5vw,32px); }
.landing-nav-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex: 0 0 auto; }
.landing-nav a:hover, .landing-footer a:hover { color: #f2ae91; }
.landing-link-button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; background: transparent; border: 1px solid #ffffff40; padding: 8px 16px; border-radius: 6px; color: #f6f4f4; font: inherit; line-height: 1.2; white-space: nowrap; cursor: pointer; }
.landing-nav-actions .landing-link-button.hidden { display: none !important; }
.landing-hero { width: min(1220px,calc(100% - 48px)); min-height: 520px; margin: auto; display: grid; grid-template-columns: 1fr .9fr; align-items: center; gap: 24px; }
.landing-kicker { color: #e7a183; font-size: 11px; font-weight: 800; letter-spacing: .19em; }
.landing-copy h1 { margin: 22px 0; font-size: clamp(51px,6.5vw,96px); letter-spacing: -.075em; line-height: .98; }
.landing-copy h1 em { font-style: normal; color: #d88d72; }
.landing-copy > p:not(.landing-kicker) { max-width: 535px; color: #adaab0; font-size: clamp(16px,1.4vw,19px); line-height: 1.65; }
.landing-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.landing-cta button, .landing-last button { min-height: 48px; padding: 12px 24px; border-radius: 10px; background: linear-gradient(120deg,#b86e58,#e5a080); color: #161018; font-size: 14px; }
.landing-cta .landing-outline { color: #f4e7e3; border: 1px solid #735e59; background: transparent; }
.landing-art { min-height: 460px; display: grid; place-content: center; position: relative; background: radial-gradient(ellipse at 50% 50%,#ae694441,transparent 62%); }
.landing-orbit { width: clamp(245px,30vw,430px); height: clamp(245px,30vw,430px); display: grid; place-items: center; border: 1px solid #e2997840; border-radius: 50%; box-shadow: 0 0 0 40px #d9836020,0 0 0 100px #c0704e09; }
.landing-orbit img { width: 74%; object-fit: contain; filter: drop-shadow(0 30px 44px #0008); }
.landing-orbit-note { position: absolute; right: 4%; bottom: 14%; padding: 13px 18px; border: 1px solid #d5967866; border-radius: 10px; background: #211b20; color: #f8d3c2; font-size: 12px; }
.landing-section { width: min(1220px,calc(100% - 48px)); margin: 0 auto; padding: 68px 0; border-top: 1px solid #ffffff19; }
.landing-section-intro h2, .landing-last h2 { margin: 9px 0 18px; font-size: clamp(32px,4vw,52px); letter-spacing: -.05em; }
.landing-section-intro > p:last-child { color: #acaab0; }
.landing-feature-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-top: 34px; }
.landing-feature-grid article, .landing-staff-card { padding: 24px; border: 1px solid #ffffff1c; border-radius: 8px; background: linear-gradient(140deg,#24202a,var(--bg-1)); }
.landing-feature-grid span { color: #dc9a7e; font-size: 11px; font-weight: 750; letter-spacing: .12em; }
.landing-feature-grid h3 { margin: 28px 0 12px; font-size: 22px; }
.landing-feature-grid p { margin: 0; color: #b1afb5; line-height: 1.6; }
.landing-team { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: center; }
.landing-staff-card { display: flex; align-items: center; gap: 22px; min-height: 146px; }
.landing-staff-card img { width: 76px; height: 76px; object-fit: contain; }
.landing-staff-card strong { display: block; font-size: 20px; }
.landing-staff-card span { display: block; margin-top: 6px; color: #dd9f85; }
.landing-last { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.landing-footer { flex-wrap: wrap; min-height: 112px; border-top: 1px solid #ffffff18; }
.landing-footer small { color: #8e898e; }
.auth-logo { width: 52px; height: 52px; object-fit: contain; }
.auth-back-link { display: inline-block; margin-top: 18px; color: #b8a6a9; text-decoration: none; font-size: 12px; }
.auth-back-link:hover { color: #f2ae91; }
.rail-brand img { width: 38px; height: 38px; object-fit: contain; }
.legal-page { width: 100%; min-height: 100dvh; margin: 0; overflow-y: auto; background: var(--surface-rail); color: #f4f0f0; }
.legal-shell { width: min(780px,calc(100% - 40px)); margin: 0 auto; padding: 30px 0 80px; }
.legal-shell header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 75px; }
.legal-shell header > a:last-child { color: #dca185; font-size: 13px; }
.legal-shell h1 { font-size: clamp(36px,5vw,58px); letter-spacing: -.055em; margin: 8px 0; }
.legal-shell h2 { font-size: 22px; margin-top: 34px; }
.legal-shell p, .legal-shell li { color: #bab9c0; line-height: 1.75; }
.legal-shell footer { border-top: 1px solid #ffffff20; margin-top: 55px; padding-top: 22px; display: flex; flex-wrap: wrap; gap: 20px; color: #dca185; }

/* Community lists and editors */
.navigator-grid { grid-template-columns: repeat(auto-fill,minmax(min(100%,280px),1fr)); }
.navigator-card { width: 100%; max-width: 380px; min-height: 315px; }
#member-roles-dialog { width: min(520px,calc(100vw - 26px)); }
.role-search-label { margin-top: 18px; color: #d5dfea; }
.role-selection-count { margin: 12px 0 4px; }
.member-role-options { gap: 8px; margin-top: 8px; }
.member-role-option { min-height: 56px; padding: 12px 14px; border-radius: 11px; background: var(--bg-2); cursor: pointer; }
.member-role-option:hover { border-color: #8b68d7; }
.member-role-option:has(input:checked) { border-color: #9b75ec; background: #302747; }
.member-role-option[hidden] { display: none; }
.member-role-option-visual { font-size: 13px; }
.role-empty-state { padding: 20px; border: 1px dashed #657184; border-radius: 11px; color: #b9c7d8; line-height: 1.5; }
#channel-settings-dialog .channel-settings-content { display: grid; gap: 16px; padding-right: 18px; }
#channel-settings-dialog .channel-settings-section { padding: 22px; border: 1px solid #ffffff19; border-radius: 15px; background: var(--bg-2); }
#channel-settings-dialog .channel-settings-section h3 { margin: 0 0 22px; font-size: 20px; letter-spacing: -.03em; }
#channel-settings-dialog .channel-settings-section .settings-field-row { margin: 0 0 18px; gap: 18px; }
#channel-settings-dialog .channel-settings-section > label { margin-bottom: 18px; }
#channel-settings-dialog .channel-settings-section label { color: #c9d5e3; font-size: 12px; }
#channel-settings-dialog .channel-settings-section input,
#channel-settings-dialog .channel-settings-section textarea,
#channel-settings-dialog .channel-settings-section select { margin-top: 6px; border-radius: 10px; }
#channel-settings-dialog .channel-settings-section-heading p { max-width: 620px; line-height: 1.55; margin-bottom: 22px; }
#channel-settings-dialog .channel-role-override { padding: 17px; border-radius: 12px; background: var(--bg-2); }
.profile-popout { width: min(400px,calc(100vw - 20px)); border-width: 1px; border-color: color-mix(in srgb,var(--profile-accent) 52%,transparent); border-radius: 19px; }
.profile-banner { height: 126px; }
.profile-body { padding: 0 22px 23px; }
.profile-avatar-row { height: 52px; }
.profile-title-copy h3 { margin: 10px 0 4px; font-size: 23px; }
.profile-role-line { margin-top: 8px; font-size: 12px; gap: 8px; }
.profile-handle { margin-top: 5px; font-size: 12px; }
.profile-status { margin-top: 12px; padding: 7px 10px; border-radius: 8px; font-size: 11px; }
.profile-popout .badge-row { margin: 17px 0 14px; gap: 8px; }
.profile-popout .profile-badge { width: 32px; height: 32px; min-height: 32px; border-radius: 9px; }
.profile-bio { max-height: 95px; font-size: 12px; line-height: 1.65; }
.profile-sections { gap: 11px; margin-top: 17px; }
.profile-custom-section { padding: 14px; border-radius: 11px; }
.profile-section-title { font-size: 11px; }
.profile-rep { margin-top: 18px; padding-top: 13px; font-size: 11px; }
.profile-edit-button { margin-top: 16px; }
.mobile-drawer-backdrop { display: none; }
@media (max-width: 760px) {
  .landing-nav { min-height: 64px; }
  .landing-nav-links { display: none; }
  .landing-hero { grid-template-columns: 1fr; min-height: 0; gap: 0; padding: 48px 0 30px; }
  .landing-art { min-height: 300px; overflow: hidden; }
  .landing-orbit { width: 210px; height: 210px; box-shadow: 0 0 0 30px #d9836019,0 0 0 65px #c0704e09; }
  .landing-orbit-note { bottom: 2%; right: 1%; }
  .landing-section { padding: 44px 0; }
  .landing-feature-grid, .landing-team { grid-template-columns: 1fr; }
  .landing-last { align-items: flex-start; flex-direction: column; }
  .landing-footer { padding: 28px 0; }
  .landing-footer > div { flex-wrap: wrap; }
  .app-shell, .app-shell.home-mode { display: block !important; height: 100dvh; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .community-rail { position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 90; width: 100% !important; height: calc(64px + env(safe-area-inset-bottom)); padding: 6px 9px max(6px,env(safe-area-inset-bottom)); flex-direction: row; align-items: center; gap: 6px; border-top: 1px solid #ffffff23; border-right: 0; background: var(--bg-1); }
  .community-rail .rail-separator { height: 28px; width: 1px; flex: 0 0 1px; }
  .community-list { display: flex; flex-direction: row; align-items: center; flex: 1 1 auto; min-width: 0; overflow-x: auto; overflow-y: hidden; gap: 6px; padding: 0; scrollbar-width: none; }
  .community-list { touch-action: pan-x; }
  .community-list::-webkit-scrollbar { display: none; }
  .community-rail .community-button, .community-rail .rail-action, .community-rail .rail-brand { flex: 0 0 43px; width: 43px; height: 43px; min-height: 43px; margin: 0; }
  .community-rail #create-community-button { flex: 0 0 43px; }
  .channel-sidebar { left: 0 !important; top: 0; bottom: calc(64px + env(safe-area-inset-bottom)); width: min(320px,calc(100vw - 36px)) !important; z-index: 82; }
  .member-sidebar { bottom: calc(64px + env(safe-area-inset-bottom)); width: min(320px,calc(100vw - 36px)) !important; z-index: 83; }
  .content-pane { display: flex; width: 100%; height: 100%; min-width: 0; }
  .mobile-drawer-backdrop:not(.hidden) { display: block; position: fixed; inset: 0 0 calc(64px + env(safe-area-inset-bottom)); z-index: 78; width: 100%; height: auto; padding: 0; border-radius: 0; background: #02050baa; }
  .content-header { padding: 0 12px; }
  .content-header .icon-button { flex: 0 0 38px; min-height: 38px; }
  .messages { padding: 12px 12px 8px; }
  .composer { margin: 0 10px 10px; }
  .navigator-grid { grid-template-columns: repeat(auto-fill,minmax(min(100%,250px),1fr)); }
  #channel-settings-dialog .channel-settings-content { padding-right: 0; }
  #channel-settings-dialog .channel-settings-section { padding: 16px; }
  #channel-settings-dialog .channel-settings-section .settings-field-row { grid-template-columns: 1fr; gap: 12px; }
  .profile-popout { width: auto; }
}
@media (max-width: 380px) {
  .community-rail .community-button, .community-rail .rail-action, .community-rail .rail-brand { flex-basis: 39px; width: 39px; height: 39px; min-height: 39px; }
  .landing-nav, .landing-hero, .landing-section, .landing-footer { width: calc(100% - 32px); }
}
@media (max-width: 760px) {
  .app-shell.hidden, .app-shell.home-mode.hidden { display: none !important; }
}
@media (max-width: 420px) {
  .landing-copy h1 { font-size: clamp(43px,12vw,50px); }
}

@media (max-width: 760px) {
  html, body { min-height: 100dvh; overscroll-behavior: none; }
  body { overflow: hidden; }
  button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
  button:focus-visible, a:focus-visible, input:focus-visible,
  textarea:focus-visible, select:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 78%, white 10%);
    outline-offset: 2px;
  }
  .app-shell, .app-shell.home-mode {
    display: block !important;
    position: relative;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 0 0 calc(64px + env(safe-area-inset-bottom));
    overflow: hidden;
  }
  .content-pane {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .content-header { flex: 0 0 auto; min-width: 0; }
  .friends-view, .chat-view, .call-view, .navigator-view, .empty-state {
    min-width: 0;
    min-height: 0;
  }
  .friends-toolbar { flex: 0 0 auto; min-width: 0; }
  .friends-tabs { min-width: 0; }
  .friends-tab { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .add-friend-form { min-width: 0; }
  .add-friend-form input { min-width: 0; }
  .friends-list { min-height: 0; overscroll-behavior: contain; }
  .social-person-row { min-width: 0; }
  .social-person-actions { flex: 0 0 auto; }
  .mobile-drawer-backdrop:not(.hidden) {
    pointer-events: auto;
    touch-action: none;
  }
  .community-rail {
    position: fixed;
    z-index: 90;
    isolation: isolate;
  }
  .channel-sidebar, .member-sidebar {
    max-height: none;
    overscroll-behavior: contain;
  }
  .channel-scroll, .member-scroll { overscroll-behavior: contain; }
  .channel-scroll { touch-action: pan-y; }
  dialog.modal {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}

.community-button[draggable="true"] { cursor: grab; }
.community-button.dragging { opacity: .4; cursor: grabbing; }
.community-button.touch-dragging { opacity: .55; transform: scale(.92); }
.channel-button.touch-dragging, .channel-topic-heading.touch-dragging { opacity: .55; transform: scale(.98); }
.touch-drop-target { outline: 2px solid var(--accent); outline-offset: -2px; }
.community-button.drop-target { outline: 2px solid #e3a284; outline-offset: 2px; }

body.app-only #landing-view, body.app-only .auth-back-link { display: none !important; }
.landing-cta .landing-download { display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 14px 27px; border: 1px solid #efb49c; border-radius: 10px; background: linear-gradient(120deg,#b86e58,#e5a080); box-shadow: 0 12px 32px #b86e5835; color: #161018 !important; font-size: 15px; font-weight: 800; white-space: nowrap; }
.landing-cta .landing-download:hover { background: linear-gradient(120deg,#d5876d,#f0b198); box-shadow: 0 16px 38px #b86e5855; }
.landing-cta .landing-outline { background: transparent; color: #f4e7e3; }

.landing-download-help { margin: 10px 0 0; color: #9c9ca5; font-size: 12px !important; }

/* Relay desktop layout refinements */
@media (min-width: 761px) {
  .member-sidebar.collapsed { display: none !important; }
}
#members-toggle[aria-pressed="false"] { color: var(--muted); }
.navigator-card-body { display: flex; flex-direction: column; gap: 11px; }
.navigator-card-top { min-height: 55px; margin-top: -26px; }
.navigator-card-identity { align-self: center; padding: 0; }
.navigator-card-statuses { min-height: 0; }
.navigator-card-description { min-height: 0; margin: 0; }
.navigator-card { border-radius: 9px; }
.profile-popout { width: min(320px,calc(100vw - 20px)); border-radius: 10px; }
.profile-banner { height: 92px; }
.profile-body { padding: 0 16px 16px; }
.profile-avatar { width: 64px; height: 64px; margin-top: -35px; }
.profile-title-copy h3 { font-size: 18px; }
@media (max-width: 760px) { .profile-popout { width: min(320px,calc(100vw - 20px)); } }

.member-muted-tag { padding: 3px 5px; border: 1px solid #dc897055; border-radius: 4px; color: #e8a487; font-size: 8px; font-weight: 800; letter-spacing: .055em; }
.relay-action-dialog { width: min(440px,calc(100vw - 28px)); border-radius: 9px; }
.relay-action-dialog form { display: grid; gap: 14px; }
.relay-action-dialog label { display: grid; gap: 7px; color: var(--text-soft); font-size: 12px; }
.relay-action-dialog input,.relay-action-dialog textarea,.relay-action-dialog select { width: 100%; }

.composer-attach { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 7px; cursor: pointer; flex: 0 0 32px; font-size: 20px; color: #dfa18a; }
.message-image { display: block; max-width: min(380px,100%); max-height: 340px; margin-top: 9px; border-radius: 7px; object-fit: contain; background: transparent; }
.message-gif-attachment { position: relative; display: inline-block; max-width: min(380px,100%); margin-top: 6px; line-height: 0; }
.message-gif-attachment .message-image { max-width: 100%; margin-top: 0; }
.message-gif-bookmark { position: absolute; top: 8px; right: 8px; z-index: 2; display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid #ffffff60; border-radius: 7px; background: #111820d9; opacity: 0; pointer-events: none; cursor: pointer; transition: opacity .12s ease,background .12s ease; }
.message-gif-bookmark .ui-icon { width: 18px; height: 18px; }
.message-gif-bookmark.is-saved { background: color-mix(in srgb,var(--accent) 82%,#111820); }
.message-gif-attachment:hover .message-gif-bookmark,
.message-gif-attachment:focus-within .message-gif-bookmark { opacity: 1; pointer-events: auto; }
.message-gif-bookmark:focus-visible { opacity: 1; pointer-events: auto; outline: 2px solid var(--accent); outline-offset: 2px; }
.message-video-preview { display: flex; flex-direction: column; width: min(320px,100%); margin-top: 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; color: var(--text-soft); text-decoration: none; }
.message-video-preview img { width: 100%; max-height: 180px; object-fit: cover; }
.message-video-preview span { padding: 9px 12px; }

/* Chat attachments share one aligned composer row. */
.composer { flex-direction: column; align-items: stretch; gap: 5px; }
.composer-row { display: flex; align-items: end; gap: 8px; width: 100%; }
.composer-row #message-input { flex: 1 1 auto; min-width: 0; width: 0; max-height: 120px; height: 35px; resize: none; overflow-x: hidden; overflow-y: hidden; overflow-wrap: anywhere; word-break: break-word; white-space: pre-wrap; tab-size: 4; line-height: 1.4; }
.composer-attach, .composer-cancel-edit { align-self: flex-end; }
.composer-attach { width: 34px; height: 34px; flex: 0 0 34px; padding: 0; border-radius: 6px; background: var(--bg-4); line-height: 1; }
.composer-cancel-edit { width: 34px; height: 34px; min-height: 34px; flex: 0 0 34px; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-hover); color: var(--text-soft); font-size: 18px; }
.composer.editing-message { border-color: rgba(231,204,115,.78); background: rgba(231,204,115,.16) !important; box-shadow: 0 0 0 2px rgba(231,204,115,.12); }
.composer-format-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; min-height: 29px; }
.composer-format-tools button { min-width: 30px; width: auto; height: 27px; min-height: 27px; padding: 0 6px; border-radius: 5px; background: transparent; color: var(--muted); box-shadow: none; }
.composer-format-tools button:hover { background: var(--surface-hover); color: var(--text); }
.composer-format-tools button:focus-visible { outline: 2px solid var(--accent); }
.composer-format-divider { width: 1px; height: 19px; margin: 0 3px; background: var(--line-strong); }
.message-content .message-line { min-height: 1em; }
.message-content .message-heading { margin: 3px 0; color: var(--text); line-height: 1.3; }
.message-content h2.message-heading { font-size: 1.45em; }
.message-content h3.message-heading { font-size: 1.25em; }
.message-content h4.message-heading { font-size: 1.1em; }
.message-content .message-small-text { display: block; margin: 2px 0; color: var(--muted); font-size: .78em; line-height: 1.35; }
.message-content .message-quote { margin: 3px 0; padding-left: 9px; border-left: 3px solid var(--line-strong); color: var(--text-soft); }
.message-content .message-spoiler { border-radius: 3px; background: var(--line-strong); color: transparent; cursor: pointer; user-select: none; }
.message-content .message-spoiler.revealed { background: color-mix(in srgb,var(--accent) 15%,transparent); color: inherit; user-select: text; }
.composer-attach:hover { background: var(--bg-4); }
.chat-reply-preview { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 5px 8px; border-left: 2px solid var(--accent); background: var(--bg-2); color: var(--text-soft); font-size: 11px; }
.chat-reply-preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-reply-preview button { width: 26px; height: 26px; min-height: 26px; flex: 0 0 26px; padding: 0; background: transparent; color: var(--muted); font-size: 18px; }
.pins-dialog { width: min(520px, calc(100vw - 28px)); }
.pinned-message-list { display: grid; gap: 6px; max-height: min(60vh,560px); overflow-y: auto; }
.pinned-message-item { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-2); color: var(--text-soft); text-align: left; }
.pinned-message-item span { overflow: hidden; max-width: 100%; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.chat-attachment-preview { display: flex; align-items: center; gap: 10px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-2); color: var(--text-soft); font-size: 12px; }
.chat-attachment-preview img { max-width: 48px; max-height: 48px; object-fit: contain; border-radius: 4px; }
.chat-attachment-preview button { margin-left: auto; width: 26px; height: 26px; padding: 0; border-radius: 4px; }
.message-image { max-width: min(320px, 100%); max-height: 300px; margin-top: 6px; }

.chat-view { position: relative; }
.mention-suggestions {
  position: absolute;
  z-index: 48;
  left: 14px;
  bottom: 72px;
  width: min(380px,calc(100% - 28px));
  max-height: min(340px,48%);
  display: grid;
  gap: 3px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-menu);
  box-shadow: 0 16px 40px rgba(0,0,0,.48);
}
.mention-suggestion {
  width: 100%;
  min-height: 48px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent !important;
  color: var(--text);
  text-align: left;
  box-shadow: none !important;
}
.mention-suggestion strong { font-size: 12px; }
.mention-suggestion span { color: var(--muted); font-size: 10px; font-weight: 500; }
.mention-suggestion.active,
.mention-suggestion:hover { border-color: var(--line); background: var(--surface-hover) !important; filter: none !important; }
@media (max-width: 760px) {
  .mention-suggestions {
    left: 8px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    width: calc(100% - 16px);
    max-height: min(320px,44%);
  }
}

/* Compact reactions for channel and direct messages. */
.message-reactions { display:flex; align-items:center; flex-wrap:wrap; gap:5px; margin-top:5px; }
.message-reactions button { font:inherit; cursor:pointer; }
.reaction-chip, .reaction-add {
  border:1px solid var(--bg-4); border-radius:6px; min-height:27px;
  padding:2px 8px; background:var(--bg-3); color:#dce5f0;
}
.reaction-chip.mine { background:#393043; border-color:#ab735e; color:#ffe0d2; }
.reaction-chip:hover, .reaction-add:hover { border-color:#b77b62; }
.reaction-add { width:30px; height:28px; padding:0; box-shadow:0 6px 18px #0008; }
.reaction-chooser { position:absolute; top:-13px; right:8px; left:auto; z-index:12; }
.message-action-cluster { display: flex; flex-flow: row nowrap; align-items: center; gap: 3px; width: max-content; padding: 2px 4px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface-menu); box-shadow: 0 5px 14px rgba(0,0,0,.2); }
.message-action-inline { width: 28px; min-width: 28px; height: 28px; min-height: 28px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent !important; color: var(--muted); font-size: 15px; box-shadow: none !important; }
.message-action-inline img { width: 15px; height: 15px; opacity: .82; }
.message-action-inline-report:hover { color: #efaa6c; }
.message-action-inline-pin[aria-label="Unpin message"] { color: var(--accent); }
.message-action-inline:hover { background: var(--surface-hover) !important; color: var(--text); filter: none !important; }
.message-action-inline-delete { color: #ff7f8e; }
.message-action-inline-delete:hover { background: rgba(239,95,113,.14) !important; color: #ffb0ba; }
.message-action-cluster .reaction-add { display: grid; place-items: center; border: 0 !important; color: var(--text-soft); box-shadow: none; }
@media (hover: hover) {
  .message .reaction-chooser { display:none; }
  .message:hover .reaction-chooser,
  .message:focus-within .reaction-chooser { display:flex; }
}
.reaction-picker {
  position:fixed; z-index:900; display:flex; flex-direction:column; gap:9px;
  width:min(345px,calc(100vw - 16px)); max-height:min(420px,calc(100dvh - 16px));
  padding:12px; background:var(--surface-menu); border:1px solid var(--line-strong);
  border-radius:9px; box-shadow:0 20px 54px #000b;
}
.reaction-picker strong { font-size:13px; }
.reaction-picker small { color:var(--muted); font-size:11px; }
.reaction-quick, .reaction-filters { display:flex; align-items:center; gap:5px; }
.reaction-filters input { flex:1; min-width:0; height:35px; }
.reaction-filters select { width:123px; min-width:0; height:35px; }
.reaction-emoji-grid {
  display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:2px;
  min-height:70px; max-height:227px; overflow-y:auto; align-content:start;
}
.reaction-picker .reaction-emoji {
  width:100%; min-width:0; height:34px; padding:2px; border:0;
  border-radius:5px; background:transparent; font-size:21px; line-height:1;
}
.reaction-emoji:hover, .reaction-emoji:focus-visible { background:var(--surface-hover) !important; }
.reaction-quick .reaction-emoji { flex:1; }
.reaction-more { align-self:center; padding:4px 8px; border:0; background:transparent; color:var(--text-soft); font-size:11px; }
.reaction-more:hover { color:var(--text); }
.reaction-no-results { grid-column:1/-1; padding:16px 4px; color:var(--muted); font-size:12px; }
@media (max-width: 520px) {
  .reaction-picker { width:min(320px,calc(100vw - 16px)); }
}

.notification-control { position:relative; margin-left:auto; }
#notification-toggle { position:relative; }
.notification-count {
  position:absolute; top:-5px; right:-5px; min-width:17px; height:17px;
  padding:1px 4px; background:#b87360; color:#fff; border-radius:9px;
  font-size:10px; line-height:15px; font-weight:700;
}
.notification-panel {
  position:absolute; top:calc(100% + 12px); right:0; z-index:80;
  width:min(370px,calc(100vw - 28px)); max-height:min(520px,75vh);
  overflow:auto; background:var(--bg-2); border:1px solid var(--bg-4);
  border-radius:8px; box-shadow:0 18px 46px #000b;
}
.notification-panel-header { display:flex; justify-content:space-between; align-items:center; padding:13px 15px; border-bottom:1px solid var(--bg-4); }
.notification-panel-header button { color:#d9a891; border:0; background:none; cursor:pointer; }
.notification-item { width:100%; display:grid; gap:4px; padding:11px 15px; border:0; border-bottom:1px solid var(--bg-3); background:transparent; text-align:left; color:#eef1f5; cursor:pointer; }
.notification-item:hover { background:var(--bg-3); }
.notification-item.unread { border-left:3px solid #b87360; }
.notification-item span { color:#b5c0cd; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.notification-item small { color:#8595a6; }
.notification-empty { padding:15px; }

.ticket-type-list { display: grid; gap: 8px; margin: 16px 0; }
.ticket-type-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; background: var(--surface-2, var(--bg-3)); border: 1px solid var(--border, var(--bg-4)); border-radius: 8px; }
.ticket-type-row > div { display: grid; gap: 3px; min-width: 0; }
.ticket-type-row .subtle { overflow-wrap: anywhere; }
.ticket-type-field { display: grid; gap: 7px; margin: 14px 0; }
.ticket-type-form { border-top: 1px solid var(--border, var(--bg-4)); padding-top: 16px; }
@media (max-width: 520px) { .ticket-type-row { align-items: flex-start; } .ticket-type-row button { flex-shrink: 0; } }
.channel-button.channel-drop-before { box-shadow: inset 0 3px 0 var(--accent, #c78068); }
.theme-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.theme-presets button { min-height: 34px; }
.theme-presets button[data-theme-preset="relay"] { border-left: 4px solid #b97560; }
.theme-presets button[data-theme-preset="indigo"] { border-left: 4px solid #7662b9; }
.theme-presets button[data-theme-preset="forest"] { border-left: 4px solid #518b76; }

/* Account themes color the shell and its nested surfaces. */
.community-rail { background: var(--surface-rail); }
.channel-sidebar, .member-sidebar { background: var(--surface-sidebar); }
.content-pane {
  background: radial-gradient(circle at 50% -30%, color-mix(in srgb,var(--accent) 4%,transparent), transparent 45%), var(--surface-chat);
}
.content-header, .members-header { background: var(--surface-header); }
.community-header {
  background: linear-gradient(90deg,
    color-mix(in srgb,var(--surface-sidebar) 94%,transparent),
    color-mix(in srgb,var(--surface-sidebar) 78%,transparent)),
    var(--community-banner);
  background-size: cover; background-position: center;
}
.user-dock { background: var(--surface-rail); }
.composer, .chat-attachment-preview { background: var(--surface-input); }
.composer-tool, .composer-attach { background: var(--surface-hover); }
.composer-attach:hover, .composer-tool:hover { background: var(--bg-4); }
.community-button, .rail-action, .empty-icon, .message-avatar { background: var(--bg-2); }
.rail-action { background: color-mix(in srgb,var(--accent) 12%,var(--bg-2)); }
.channel-button:hover, .special-channel:hover, .dm-button:hover, .home-nav-button:hover,
.member-button:hover { background: var(--surface-hover); }
.channel-button.active, .dm-button.active, .home-nav-button.active {
  background: color-mix(in srgb,var(--accent) 14%,var(--surface-hover));
}
dialog.modal, .app-context-menu, .notification-panel, .sidebar-create-menu,
.reaction-picker { background: var(--surface-menu); border-color: var(--line-strong); }
.settings-card, .ticket-card, .channel-settings-section,
.channel-role-override, .ticket-type-row, .profile-section-editor,
.staff-section, .staff-stat { background: var(--bg-1); }
.editor-nav button:hover, .editor-nav button:focus-visible,
.sidebar-create-menu button:hover, .sidebar-create-menu button:focus-visible,
.reaction-picker button:hover, .notification-item:hover { background: var(--surface-hover); }
.editor-nav button.active { background: color-mix(in srgb,var(--accent) 16%,var(--bg-3)); }
.file-picker-button { background: var(--surface-input) !important; }
.file-picker.has-file .file-picker-button {
  background: color-mix(in srgb,var(--accent) 12%,var(--surface-input)) !important;
}
.reaction-chip, .reaction-add { background: var(--surface-input); border-color: var(--line-strong); }
.reaction-chip.mine { background: color-mix(in srgb,var(--accent) 18%,var(--surface-input)); }
.notification-item { border-bottom-color: var(--line); }
.notification-panel-header { border-bottom-color: var(--line); }
.context-menu-header, .context-menu-item small { color: var(--muted); }
.context-menu-item { color: var(--text-soft); }
.app-shell input:not([type="color"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.app-shell textarea, .app-shell select,
dialog.modal input:not([type="color"]):not([type="checkbox"]):not([type="file"]),
dialog.modal textarea, dialog.modal select {
  background: var(--surface-input); border-color: var(--line-strong); color: var(--text);
}
button.button-secondary, .file-picker-button { background: var(--surface-input) !important; }
.sidebar-display, .social-person-row, .navigator-card, .navigator-empty,
.staff-detail-grid > div, .staff-notes article, .staff-transcript article,
.achievement-card { background: var(--bg-1); }
.sidebar-display strong, .navigator-card-description { color: var(--text-soft); }
.section-heading, .member-group-title, .sidebar-empty, .member-count,
.message-time, .dm-button-copy span { color: var(--muted); }
.message-content { color: var(--text-soft); }
.message-image { background: transparent; }
.member-role-option:hover { border-color: var(--accent); }
.member-role-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb,var(--accent) 16%,var(--surface-input));
}
.community-button { position: relative; }
.community-activity-badges { position: absolute; top: -3px; right: -3px; z-index: 3; display: flex; align-items: center; gap: 2px; padding: 2px; border: 2px solid var(--surface-rail); border-radius: 8px; background: var(--surface-rail); }
.community-ping-dot, .community-unread-dot { display: block; border-radius: 50%; }
.community-ping-dot { min-width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; border: 1px solid var(--surface-rail); border-radius: 999px; background: #d6293e; color: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4); font-size: 9px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.community-unread-dot { width: 8px; height: 8px; }
.community-unread-dot { background: #fff; }
.channel-unread-dot { width: 7px; height: 7px; flex: 0 0 7px; margin-left: auto; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.45); }
@media (max-width: 760px) {
  .community-rail { background: var(--surface-rail); }
  .channel-sidebar, .member-sidebar { background: var(--surface-sidebar); }
}

/* Topic and role permission editors */
.permission-groups { display: grid; gap: 14px; margin-top: 14px; }
.permission-group { padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-1); }
.permission-group h4 { margin: 0 0 8px; font-size: 12px; }
.permission-group .permission-grid { margin-top: 0; }
#topic-settings-dialog { width: min(820px, calc(100vw - 28px)); }
.topic-settings-form .modal-heading { border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.topic-settings-form h3 { margin: 18px 0 4px; }
.topic-settings-form .topic-permission-rows { max-height: min(48vh, 490px); overflow: auto; margin-top: 14px; }
.topic-settings-form .settings-form-actions { position: sticky; bottom: -20px; background: var(--bg-2); padding: 12px 0; }
@media (max-width: 700px) {
  .permission-group .permission-grid { grid-template-columns: 1fr; }
  .topic-settings-form .channel-role-override { grid-template-columns: 1fr; }
}

/* Refined profile and moderation presentation */
.profile-popout {
  width: min(410px,calc(100vw - 24px));
  max-height: min(790px,calc(100dvh - 20px));
  border: 1px solid color-mix(in srgb,var(--profile-accent) 44%,transparent);
  border-radius: 12px;
  box-shadow: 0 22px 68px rgba(0,0,0,.52);
}
.profile-banner { height: 154px; }
.profile-body { padding: 0 18px 18px; }
.profile-avatar-row { height: 52px; }
.profile-avatar { top: -56px; width: 96px !important; height: 96px !important; }
.profile-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-title-copy { min-width: 0; flex: 1; }
.profile-name-role-row { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.profile-title-copy h3 { min-width: 0; margin: 5px 0 2px; font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.profile-name-role-row .profile-role-line { width: fit-content; margin: 0; padding: 4px 8px; border: 1px solid color-mix(in srgb,var(--profile-accent) 28%,transparent); border-radius: 999px; background: color-mix(in srgb,var(--profile-accent) 14%,var(--profile-card)); font-size: 10px; }
.profile-handle { font-size: 12px; }
.profile-presence { font-size: 10px; }
.profile-message-button { min-height: 34px; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid color-mix(in srgb,var(--profile-accent) 35%,transparent); border-radius: 6px; background: color-mix(in srgb,var(--profile-accent) 14%,var(--profile-card)); color: var(--profile-text); font-size: 11px; }
.profile-message-button .ui-icon { width: 15px; height: 15px; }
.profile-popout .badge-row { gap: 6px; margin: 12px 0 10px; }
.profile-popout .profile-badge { min-height: 26px; padding: 4px 8px; border-radius: 6px; font-size: 10px; }
.profile-popout .profile-badge-icon { width: 15px; height: 15px; }
.profile-bio-wrap { min-height: 112px; margin-top: 14px; padding: 13px 14px; border: 1px solid color-mix(in srgb,var(--profile-text) 10%,transparent); border-radius: 7px; background: color-mix(in srgb,var(--profile-text) 4%,var(--profile-card)); }
.profile-bio-heading { display: block; margin-bottom: 6px; color: var(--profile-muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.profile-bio { max-height: 180px; color: var(--profile-text); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.profile-bio-empty { color: var(--profile-muted); }
.profile-bio-toggle { margin-top: 6px; font-size: 10px; }
.profile-sections { gap: 8px; margin-top: 10px; }
.profile-custom-section { padding: 10px; border-radius: 7px; }
.profile-section-title { margin-bottom: 7px; font-size: 10px; }
.profile-rep { margin-top: 12px; padding-top: 10px; font-size: 10px; }
.profile-edit-button { min-height: 38px; margin-top: 12px; border-radius: 7px; font-size: 11px; }
.profile-actions-toggle .ui-icon { width: 18px; height: 18px; }
.profile-action-menu-item { min-height: 36px; font-size: 11px; }
.profile-action-dialog textarea { min-height: 94px; }
.message-action-cluster { gap: 2px; padding: 3px; border-radius: 8px; }
.message-action-inline, .message-action-cluster .reaction-add { width: 30px; min-width: 30px; height: 30px; min-height: 30px; display: grid; place-items: center; padding: 0; }
.message-action-inline img, .message-action-cluster .reaction-add img { width: 16px; height: 16px; }
.message-action-inline-report:hover { background: color-mix(in srgb,#e7a35b 14%,var(--surface-hover)) !important; color: #efb76d; }
.message-action-inline-delete:hover { background: color-mix(in srgb,#e76978 16%,var(--surface-hover)) !important; }
@media (max-width: 420px) {
  .profile-popout { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .profile-banner { height: 136px; }
  .profile-body { padding-right: 14px; padding-left: 14px; }
  .profile-avatar { width: 84px !important; height: 84px !important; top: -48px; }
  .profile-title-copy h3 { font-size: 19px; }
  .profile-message-button { padding: 6px 8px; }
}

/* Mobile browser and keyboard adjustments */
@media (max-width: 760px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="range"]),
  textarea,
  select {
    font-size: 16px !important;
  }

  .auth-view {
    height: 100dvh;
    min-height: 0;
    overflow-y: auto;
    align-items: start;
    padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }

  .landing-cta {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .landing-cta > * {
    width: 100%;
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }

  dialog.modal {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  dialog.modal > form,
  dialog.modal > .modal-heading,
  dialog.modal > .settings-tabs,
  dialog.modal > .settings-content,
  dialog.modal > #tickets-content,
  dialog.modal > #invite-list,
  dialog.modal > .dialog-section-heading,
  dialog.modal > .invite-create-form,
  dialog.modal > .invite-current {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  dialog.modal > .modal-heading {
    margin-left: -16px !important;
    margin-right: -16px !important;
  }
}

/* Profile card refinement */
.profile-popout {
  width: min(390px,calc(100vw - 24px));
  max-height: min(760px,calc(100dvh - 20px));
  border: 1px solid color-mix(in srgb,var(--profile-accent) 48%,transparent);
  border-radius: 12px;
  box-shadow: 0 20px 64px rgba(0,0,0,.5);
}
.profile-banner { height: 132px; }
.profile-body { padding: 0 18px 18px; }
.profile-avatar-row { height: 48px; }
.profile-avatar { top: -50px; width: 88px !important; height: 88px !important; border-width: 5px; }
.profile-primary-actions { min-height: 36px; display: flex; justify-content: flex-end; align-items: center; margin: 0 0 7px; }
.profile-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.profile-title-copy { min-width: 0; flex: 1; }
.profile-title-copy h3 { margin: 5px 0 2px; font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.profile-handle { font-size: 12px; }
.profile-presence { font-size: 10px; }
.profile-message-button { min-height: 34px; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid color-mix(in srgb,var(--profile-accent) 35%,transparent); border-radius: 6px; background: color-mix(in srgb,var(--profile-accent) 14%,var(--profile-card)); color: var(--profile-text); font-size: 11px; }
.profile-message-button .ui-icon { width: 15px; height: 15px; }
.profile-meta-line { margin-top: 5px; }
.profile-status { margin-top: 10px; padding: 6px 9px; font-size: 11px; }
.profile-popout .badge-row { gap: 6px; margin: 12px 0 10px; }
.profile-popout .profile-badge { min-height: 26px; padding: 4px 8px; border-radius: 6px; font-size: 10px; }
.profile-popout .profile-badge-icon { width: 15px; height: 15px; }
.profile-bio-wrap { min-height: 158px; margin-top: 12px; padding: 13px 14px; border: 1px solid color-mix(in srgb,var(--profile-text) 10%,transparent); border-radius: 7px; background: color-mix(in srgb,var(--profile-text) 4%,var(--profile-card)); }
.profile-bio-heading { display: block; margin-bottom: 6px; color: var(--profile-muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.profile-bio { max-height: 180px; color: var(--profile-text); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.profile-bio-empty { min-height: 112px; display: flex; align-items: center; justify-content: center; color: var(--profile-muted); text-align: center; }
.profile-role-list-wrap { margin: 12px 0 5px; }
.profile-role-list { gap: 7px; }
.profile-role-chip { min-height: 30px; padding: 5px 9px; border-radius: 6px; font-size: 10px; }
.profile-role-chip img { width: 15px; height: 15px; }
.profile-bio-toggle { margin-top: 6px; font-size: 10px; }
.profile-sections { gap: 8px; margin-top: 10px; }
.profile-custom-section { padding: 10px; border-radius: 7px; }
.profile-section-title { margin-bottom: 7px; font-size: 10px; }
.profile-rep { margin-top: 12px; padding-top: 10px; font-size: 10px; }
.profile-edit-button { min-height: 38px; margin-top: 12px; border-radius: 7px; font-size: 11px; }
.profile-actions-toggle .ui-icon { width: 18px; height: 18px; }
.profile-action-menu-item { min-height: 36px; font-size: 11px; }

@media (max-width: 420px) {
  .profile-popout { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .profile-banner { height: 116px; }
  .profile-body { padding-right: 14px; padding-left: 14px; }
  .profile-avatar { width: 82px !important; height: 82px !important; top: -46px; }
  .profile-bio-wrap { min-height: 144px; }
  .profile-title-copy h3 { font-size: 19px; }
  .profile-message-button { padding: 6px 8px; }
}

.composer-gif {
  align-self: flex-end; min-width: 38px; height: 34px; padding: 0 7px;
  border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-hover);
  color: var(--text); font-size: 11px; font-weight: 800; cursor: pointer;
}
.composer-gif:hover { background: var(--bg-4); }
.chat-attachment-preview #chat-gif-save { margin-left: auto; padding: 5px 8px; font-size: 11px; }
.chat-attachment-preview #chat-attachment-remove { margin-left: 0; flex: 0 0 26px; }
.gif-picker-dialog {
  width: min(820px,calc(100vw - 24px)); max-width: none; max-height: min(780px,calc(100dvh - 24px));
  padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 8px;
  color: var(--text); background: var(--surface-menu);
}
dialog.modal.gif-picker-dialog { width: min(820px,calc(100vw - 24px)); }
.gif-picker { display: grid; min-height: 0; max-height: inherit; overflow: hidden; gap: 12px; padding: 16px; }
.gif-picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gif-picker-heading h2 { margin: 0; font-size: 18px; }
.gif-picker-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.gif-picker-tabs button { padding: 7px 11px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); }
.gif-picker-tabs button[aria-pressed="true"] { border-bottom-color: var(--accent); color: var(--text); }
.gif-search-label input { width: 100%; }
.gif-picker-status { min-height: 18px; color: var(--muted); font-size: 12px; }
.gif-picker-status:empty { display: none; }
.gif-picker-status:empty { display: none; }
.gif-picker-results { display: grid; min-height: 0; grid-template-columns: repeat(4,minmax(0,1fr)); grid-auto-rows: max-content; align-content: start; gap: 10px; max-height: 54dvh; overflow: auto; }
.gif-result { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-1); }
.gif-ad-result { grid-column: 1 / -1; display: grid; place-items: center; padding: 6px; }
.gif-ad-result small { justify-self: start; color: var(--muted); font-size: 10px; }
.gif-ad-frame { display: block; width: min(100%,600px); max-height: 250px; border: 0; background: var(--bg-1); }
.gif-result-media { position: relative; min-width: 0; height: 190px; }
.gif-result-select { position: relative; z-index: 0; display: block; width: 100%; height: 100%; padding: 0; overflow: hidden; border: 0; border-radius: 0; background: var(--bg-2); cursor: pointer; }
.gif-result-select img { width: 100%; height: 100%; object-fit: contain; }
.gif-result-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px; }
.gif-result-footer span { min-width: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.gif-result-footer button { flex: 0 0 auto; padding: 4px 6px; font-size: 10px; }
.gif-picker-more { justify-self: center; }
.gif-attribution { justify-self: end; color: var(--muted); font-size: 10px; text-decoration: none; }
.gif-attribution:hover { color: var(--text); }
@media (max-width: 560px) {
  .gif-picker { padding: 12px; }
  .gif-picker-results { grid-template-columns: repeat(2,minmax(0,1fr)); max-height: 58dvh; }
  .gif-result-media { height: 152px; }
}
@media (min-width: 561px) and (max-width: 760px) {
  .gif-picker-results { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
.reaction-custom-heading { display: block; margin-top: 8px; font-size: 11px; }
.reaction-custom-grid { display: flex; flex-wrap: wrap; gap: 4px; max-height: 112px; overflow: auto; }
.custom-emoji-button { display: grid; place-items: center; }
.custom-emoji-button img, .custom-emoji-image { width: 24px; height: 24px; object-fit: contain; }
.reaction-chip .custom-emoji-image { width: 18px; height: 18px; vertical-align: middle; }
.community-emoji-settings-list { display: grid; gap: 6px; margin-top: 12px; }
.community-emoji-setting-row { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.community-emoji-setting-row img { width: 32px; height: 32px; object-fit: contain; }
.community-emoji-setting-row strong { font-size: 12px; }
.community-emoji-setting-row button { margin-left: auto; }
.reply-notifications-off .ui-icon { opacity: .42; }
