/* ==========================================================================
   Design tokens: every color and key size lives here.
   Values were measured from the live Discord client (Dark theme, visual refresh).
   ========================================================================== */
:root {
  color-scheme: dark;
  --font: "Hanken Grotesk", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-code: Consolas, "Cascadia Mono", "Andale Mono WT", "Liberation Mono", monospace;

  /* surfaces */
  --bg-base-lowest: #121214;   /* title bar, server rail, DM sidebar */
  --bg-base-lower: #1a1a1e;    /* chat, header, profile column */
  --bg-base-low: #202024;      /* user panel */
  --bg-surface-high: #242429;  /* hover toolbar, popovers */
  --bg-surface-higher: #28282d;
  --bg-input: #222327;         /* composer, profile card */
  --bg-mod-subtle: rgba(151, 151, 159, 0.12);
  --bg-mod-normal: rgba(151, 151, 159, 0.16);
  --bg-mod-strong: rgba(151, 151, 159, 0.20);
  --bg-code: rgba(88, 101, 242, 0.08);

  /* interaction */
  --interactive-bg-hover: rgba(151, 151, 159, 0.12);
  --interactive-bg-active: rgba(151, 151, 159, 0.16);
  --interactive-bg-selected: rgba(151, 151, 159, 0.20);
  --message-bg-hover: rgba(151, 151, 159, 0.12);
  --message-highlight: rgba(88, 101, 242, 0.16);

  /* lines */
  --border-muted: rgba(151, 151, 159, 0.04);
  --border-subtle: rgba(151, 151, 159, 0.12);
  --border-normal: rgba(151, 151, 159, 0.20);
  --spine: #474851;

  /* text + icons */
  --text-strong: #fbfbfb;
  --text-default: #efeff1;
  --text-subtle: #abacb2;
  --text-muted: #96979e;
  --text-channels: #81828a;
  --text-placeholder: #6c6d76;
  --text-input-placeholder: #8f9097;
  --text-code: #e4e4e6;
  --text-link: #4d96ee;
  --icon-muted: #96979e;
  --icon-subtle: #abacb2;

  /* brand + status */
  --brand: #5865f2;
  --status-online: #3d9e60;
  --status-idle: #fdb833;
  --status-dnd: #da3e44;
  --status-offline: #84858d;
  --badge-red: #d22d39;
  --voice-muted: #da3e44;
  --voice-muted-bg: rgba(210, 45, 57, 0.12);

  /* reactions */
  --reaction-bg: rgba(151, 151, 159, 0.12);
  --reaction-bg-hover: rgba(151, 151, 159, 0.16);
  --reaction-me-bg: rgba(88, 101, 242, 0.24);
  --reaction-me-border: #5865f2;
  --reaction-me-text: #b9c8ff;

  /* scrollbars */
  --scroll-auto-thumb: #666770;
  --scroll-thin-thumb: #5f606a;

  /* metrics */
  --titlebar-h: 32px;
  --rail-w: 72px;
  --sidebar-w: 302px;          /* + 1px surface border = 303px */
  --header-h: 49px;            /* includes 1px bottom border */
  --profile-w: 320px;
  --user-panel-h: 58px;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; letter-spacing: -0.017em; } /* Hanken Grotesk runs ~3% wider than gg sans; this matches text widths (measured) */
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-base-lowest);
  color: var(--text-default);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.375;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0; font: inherit; }
img { display: block; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid #6aa8f4; outline-offset: 1px; border-radius: 4px; }
.ic { display: block; flex-shrink: 0; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.thin-scroll { overflow-y: auto; scrollbar-gutter: stable; }
.thin-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.thin-scroll::-webkit-scrollbar-track { background: transparent; }
.thin-scroll::-webkit-scrollbar-thumb { background-color: transparent; border: 2px solid transparent; background-clip: padding-box; border-radius: 4px; }
.thin-scroll:hover::-webkit-scrollbar-thumb { background-color: var(--scroll-thin-thumb); }

/* ==========================================================================
   App frame
   ========================================================================== */
.app { display: flex; flex-direction: column; height: 100vh; min-width: 940px; }

.titlebar {
  position: relative;
  flex: none;
  height: var(--titlebar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.tb-center { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; line-height: 18px; color: var(--text-default); }
.tb-center img { width: 18px; height: 18px; }
.tb-right { position: absolute; right: 12px; top: 0; bottom: 0; display: flex; align-items: center; gap: 12px; }
.tb-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: var(--icon-muted); }
.tb-icon:hover { color: var(--text-strong); }

.main { position: relative; flex: 1; display: flex; min-height: 0; }

/* ==========================================================================
   Server rail
   ========================================================================== */
.rail {
  flex: none;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 0 calc(var(--user-panel-h) + 24px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  user-select: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-item { position: relative; flex: none; display: flex; justify-content: center; }
.rail-pill {
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 0;
  border-radius: 0 4px 4px 0;
  background: var(--text-strong);
  transform: translateY(-50%);
  transition: height 0.15s ease-out;
}
.rail-item.unread .rail-pill { height: 8px; }
.rail-item:hover .rail-pill { height: 20px; }
.rail-item.selected .rail-pill { height: 40px; }

.rail-btn { position: relative; width: 40px; height: 40px; }
.rail-face {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-mod-subtle);
  color: var(--text-default);
  font-size: 14px;
  font-weight: 500;
  transition: border-radius 0.15s ease-out, background-color 0.15s ease-out, color 0.15s ease-out;
}
.rail-face img { width: 100%; height: 100%; }
.rail-face.round { border-radius: 50%; background: none; }
.rail-item:hover .rail-face:not(.round),
.rail-item.selected .rail-face { background: var(--brand); color: #fff; }
.rail-face.home img { width: 24px; height: 24px; }
.rail-btn.has-badge .rail-face { -webkit-mask: radial-gradient(circle at 32px 32px, transparent 11px, #000 11.5px); mask: radial-gradient(circle at 32px 32px, transparent 11px, #000 11.5px); }
.rail-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--badge-red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.02em;
  text-align: center;
}
.rail-sep { flex: none; width: 32px; height: 1px; margin: 0 auto; border-radius: 1px; background: var(--border-subtle); }

/* ==========================================================================
   Surface: sidebar + chat share one rounded, bordered card
   ========================================================================== */
.surface {
  flex: 1;
  min-width: 0;
  display: flex;
  border-top: 1px solid var(--border-subtle);
  border-left: 1px solid var(--border-subtle);
  border-top-left-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-base-lowest);
}

/* ---------- DM sidebar ---------- */
.sidebar { flex: none; width: var(--sidebar-w); display: flex; flex-direction: column; background: var(--bg-base-lowest); }
.sidebar-top {
  flex: none;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.find-btn {
  width: 100%;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: var(--bg-mod-subtle);
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.find-btn:hover { background: var(--bg-mod-normal); }
.sidebar-scroll { flex: 1; padding: 8px 0 calc(var(--user-panel-h) + 24px); }
#nav-items, #dm-list { display: flex; flex-direction: column; } /* keeps row margins from collapsing */

.nav-item {
  display: flex;
  align-items: center;
  width: 286px;
  height: 38px;
  margin: 1px 0 1px 8px;
  padding: 8px 16px 8px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
  text-align: left;
}
.nav-item .ic { margin-right: 12px; color: var(--icon-muted); }
.nav-item:hover { background: var(--interactive-bg-hover); color: var(--text-strong); }
.nav-item:hover .ic { color: var(--text-strong); }
.nav-item.selected { background: var(--interactive-bg-selected); color: var(--text-default); }
.section-divider { height: 1px; margin: 12px 0 12px 8px; background: var(--border-subtle); } /* runs under the scrollbar gutter, like the real one */

.dm-header {
  display: flex;
  align-items: center;
  height: 24px;
  padding: 0 8px 4px 16px;
  color: var(--text-channels);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  user-select: none;
}
.dm-header > span:first-child { flex: 1; min-width: 0; margin-right: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dm-header:hover { color: var(--text-strong); }
.dm-header-actions { display: flex; gap: 8px; }
.dm-header-actions button { color: var(--icon-muted); }
.dm-header-actions button:hover { color: var(--text-strong); }
.dm-header-actions .more { opacity: 0; }
.dm-header:hover .more { opacity: 1; }

.dm {
  position: relative;
  display: flex;
  align-items: center;
  width: 286px;
  height: 42px;
  margin: 1px 0 1px 8px;
  padding-left: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.dm .av { margin-right: 12px; }
.dm:hover { background: var(--interactive-bg-hover); color: var(--text-strong); }
.dm.selected { background: var(--interactive-bg-selected); color: var(--text-default); }
.dm.unread { color: var(--text-strong); }
.dm-unread-pill { position: absolute; left: -8px; top: 50%; width: 4px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: var(--text-strong); }
.dm-text { flex: 1; min-width: 0; }
.dm-name { font-size: 16px; font-weight: 500; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-sub { margin-top: -2px; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-sub .emoji { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; margin-right: 2px; }
.dm-text { margin-right: 4px; -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 16px), transparent); }
.dm-close { flex: none; display: none; width: 18px; height: 18px; margin-right: 8px; padding: 1px; place-items: center; border-radius: 50%; color: var(--text-strong); opacity: 0.7; }
.dm:hover .dm-close { display: grid; }
.dm-close:hover { opacity: 1; }

/* ---------- avatars + status dots (cut-out masks, like the real client) ---------- */
.av { position: relative; flex: none; --c: 0px; --r: 0px; --d: 0px; }
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.av.s16 { width: 16px; height: 16px; }
.av.s20 { width: 20px; height: 20px; --c: 17px; --r: 5px; --d: 6px; }
.av.s24 { width: 24px; height: 24px; --c: 20px; --r: 7px; --d: 8px; }
.av.s32 { width: 32px; height: 32px; --c: 27px; --r: 8px; --d: 10px; }
.av.s40 { width: 40px; height: 40px; --c: 34px; --r: 10px; --d: 12px; }
.av.s80 { width: 80px; height: 80px; --c: 68px; --r: 14px; --d: 16px; }
.av.has-status img {
  -webkit-mask: radial-gradient(circle at var(--c) var(--c), transparent var(--r), #000 calc(var(--r) + 0.5px));
  mask: radial-gradient(circle at var(--c) var(--c), transparent var(--r), #000 calc(var(--r) + 0.5px));
}
.status { position: absolute; left: calc(var(--c) - var(--d) / 2); top: calc(var(--c) - var(--d) / 2); width: var(--d); height: var(--d); overflow: visible; }
.status.online { color: var(--status-online); }
.status.idle { color: var(--status-idle); }
.status.dnd { color: var(--status-dnd); }
.status.offline { color: var(--status-offline); }

/* ---------- user panel (floats over rail + sidebar) ---------- */
.user-panel {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 5;
  width: calc(var(--rail-w) + var(--sidebar-w) + 1px - 16px);
  height: var(--user-panel-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  background: var(--bg-base-low);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
}
.up-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; margin-left: -4px; padding: 5px 4px; border-radius: var(--radius-xs); cursor: pointer; }
.up-user:hover { background: var(--interactive-bg-hover); }
.up-names { min-width: 0; }
.up-name { margin: -1px 0 2px; font-size: 16px; font-weight: 500; line-height: 18px; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-sub { height: 13px; overflow: hidden; font-size: 12px; font-weight: 500; line-height: 13px; color: var(--text-subtle); }
.up-sub span { display: block; transition: transform 0.15s ease-out; }
.up-user:hover .up-sub span { transform: translateY(-13px); }
.up-actions { flex: none; display: flex; gap: 8px; }
.up-group { display: flex; gap: 1px; }
.up-btn { height: 32px; display: grid; place-items: center; color: rgba(255, 255, 255, 0.9); }
.up-btn.main { width: 32px; border-radius: var(--radius-sm); }
.up-group .up-btn.main { border-radius: 8px 0 0 8px; }
.up-btn.chevron { width: 16px; border-radius: 0 8px 8px 0; color: var(--icon-subtle); }
.up-btn:hover { background: var(--bg-mod-normal); }
.up-group.off .up-btn { background: var(--voice-muted-bg); color: var(--voice-muted); }
.up-group.off .up-btn:hover { background: rgba(210, 45, 57, 0.2); }

/* ==========================================================================
   Chat
   ========================================================================== */
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-base-lower); }
.chat-header {
  flex: none;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.ch-left { flex: 1; min-width: 0; display: flex; align-items: center; }
.ch-left .av { margin-right: 8px; }
.ch-name { font-size: 16px; font-weight: 500; line-height: 20px; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
/* group DMs: the icon + name sit in one hoverable 32px pill and the header's left padding drops to 8px (measured) */
.chat-header.gdm { padding-left: 8px; }
.gdm-title { display: flex; align-items: center; gap: 8px; min-width: 0; height: 32px; padding: 0 8px; border-radius: var(--radius-sm); cursor: pointer; }
.gdm-title .av { margin-right: 4px; }
.gdm-title:hover { background: var(--interactive-bg-hover); }
.gdm-edit { display: none; flex: none; color: var(--text-default); }
.gdm-title:hover .gdm-edit { display: flex; }
.ch-right { flex: none; display: flex; align-items: center; gap: 8px; padding-left: 8px; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; color: var(--icon-muted); }
.icon-btn:hover, .icon-btn.active { color: var(--text-strong); }
.search { position: relative; width: 244px; height: 32px; margin-left: 4px; }
.search input {
  width: 100%;
  height: 100%;
  padding: 0 28px 0 8px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.12);
  color: var(--text-default);
  font: 500 14px/22px var(--font);
  outline: none;
}
.search input:focus { border-color: var(--brand); }
.search input { text-overflow: ellipsis; }
.search input::placeholder { color: var(--text-input-placeholder); }
.search .ic { position: absolute; right: 5px; top: 8px; color: var(--icon-subtle); pointer-events: none; }

.chat-body { flex: 1; min-height: 0; display: flex; }
.messages-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.scroller { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: scroll; overflow-x: hidden; }
.scroller::-webkit-scrollbar { width: 16px; }
.scroller::-webkit-scrollbar-track { background: transparent; }
.scroller::-webkit-scrollbar-thumb {
  min-height: 40px;
  background-color: var(--scroll-auto-thumb);
  border: 4px solid transparent;
  background-clip: padding-box;
  border-radius: 8px;
}
.messages { margin-top: auto; padding-bottom: 40px; }

/* ---------- conversation intro ---------- */
.welcome { margin: 16px 16px 4px; }
.welcome-avatar { width: 80px; height: 80px; border-radius: 50%; }
.welcome-name { margin-top: 8px; font-size: 32px; font-weight: 700; line-height: 40px; color: var(--text-strong); }
.welcome-username { font-size: 24px; font-weight: 500; line-height: 30px; color: var(--text-strong); }
.welcome-text { margin-top: 20px; color: var(--text-muted); }
.welcome-text strong { font-weight: 600; color: var(--text-default); }
.welcome-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.mutual { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; }
.mutual:hover { color: var(--text-strong); text-decoration: underline; }
.mutual-icons { display: flex; }
.mutual-icons span {
  width: 24px;
  height: 24px;
  margin-left: -6px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #2a2a2f;
  box-shadow: 0 0 0 2px var(--bg-base-lower);
  color: var(--text-default);
  font-size: 9px;
  font-weight: 600;
}
.mutual-icons span:first-child { margin-left: 0; }
.dot-sep { width: 4px; height: 4px; margin: 0 4px; border-radius: 50%; background: var(--text-placeholder); }
.btn { height: 32px; padding: 0 16px; border: 1px solid var(--border-muted); border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; line-height: 18px; }
.btn-secondary { background: var(--bg-mod-subtle); color: var(--text-strong); }
.btn-secondary:hover { background: var(--bg-mod-normal); }
.btn-primary { border-color: rgba(255, 255, 255, 0.08); background: var(--brand); color: #fff; }
.btn-primary:hover { background: #4752c4; }

/* ---------- date divider ---------- */
.divider { position: relative; height: 0; margin: 24px 14px 8px 16px; border-top: 1px solid var(--border-subtle); }
.divider .date {
  position: absolute;
  left: 50%;
  top: -0.5px; /* lines the label up with the rule like the real one (y - 8) */
  transform: translate(-50%, -50%);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-base-lower);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 13px;
  white-space: nowrap;
}

/* ---------- messages ---------- */
.msg { position: relative; padding: 2px 24px 2px 72px; border-radius: 0 4px 4px 0; }
.msg.group-start { margin-top: 17px; }
.msg:hover, .msg.editing { background: var(--message-bg-hover); }
.msg.replying { background: var(--message-highlight); box-shadow: inset 2px 0 0 var(--brand); }
.msg.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { background: rgba(88, 101, 242, 0.24); } 100% { background: transparent; } }

.msg-avatar { position: absolute; left: 16px; margin-top: 2px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; user-select: none; }
.msg-header { display: block; height: 22px; font-size: 16px; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-name { margin-right: 4px; font-weight: 500; color: var(--text-strong); cursor: pointer; }
.msg-name:hover { text-decoration: underline; }
.msg-ts { margin-left: 4px; font-size: 12px; font-weight: 500; line-height: 22px; color: var(--text-channels); cursor: default; }
.msg-time-hover {
  position: absolute;
  left: 0;
  width: 56px;
  text-align: right;
  font-size: 11px;
  font-weight: 500;
  line-height: 22px;
  color: var(--text-muted);
  visibility: hidden;
  user-select: none;
}
.msg:hover .msg-time-hover { visibility: visible; }
.msg.editing .msg-time-hover { visibility: hidden; }

.msg-content { font-size: 16px; line-height: 22px; color: var(--text-default); overflow-wrap: anywhere; }
.msg-content, .msg-content *, .reply-text, .reply-text *, .sys-text, .sys-text *, .edit-ta, .ta-wrap textarea { letter-spacing: -0.024em; } /* regular weight needs a little more */
.msg-content strong { font-weight: 700; }
.msg-content code, .reply-text code {
  margin: -0.2em 0;
  padding: 0 0.2em;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: var(--bg-code);
  color: var(--text-code);
  font-family: var(--font-code);
  font-size: 85%;
  line-height: 1.125rem;
}
.emoji { display: inline-block; width: 1.375em; height: 1.375em; margin: 0 0.05em 0 0.1em; vertical-align: bottom; object-fit: contain; }
.emoji.jumbo { width: 3rem; height: 3rem; min-height: 3rem; margin: 0.1em 0.05em 0 0; vertical-align: bottom; }
.edited { margin-left: 4px; font-size: 10px; font-weight: 400; line-height: 1; color: var(--text-muted); user-select: none; }

/* reply reference above a message */
.reply-ref {
  position: relative;
  display: flex;
  align-items: center;
  height: 18px;
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 18px;
  color: var(--text-subtle);
  cursor: pointer;
  user-select: none;
}
.reply-ref::before {
  content: "";
  position: absolute;
  left: -37px;
  right: calc(100% + 4px);
  top: 8px;
  bottom: -2px;
  border-left: 2px solid var(--spine);
  border-top: 2px solid var(--spine);
  border-top-left-radius: 6px;
}
.reply-ref > * { flex: none; }
.reply-ref .av { margin-right: 4px; }
.reply-name { margin-right: 4px; font-weight: 500; color: var(--text-strong); opacity: 0.64; }
.reply-text { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-ref:hover .reply-text { color: var(--text-strong); }
.reply-ref:hover .reply-name { opacity: 1; }
.reply-ref:hover::before { border-color: var(--text-muted); }
.reply-text .emoji { width: 1.25em; height: 1.25em; vertical-align: -0.3em; }
.reply-missing { font-style: italic; }

/* reactions */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0 2px; }
.reaction {
  display: flex;
  align-items: center;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--reaction-bg);
}
.reaction .emoji { width: 20px; height: 20px; margin: 2px 0; }
.reaction-count { margin-left: 6px; font-size: 14px; font-weight: 600; color: var(--text-subtle); }
.reaction:hover { background: var(--reaction-bg-hover); border-color: var(--border-muted); }
.reaction:hover .reaction-count { color: var(--text-strong); }
.reaction.me { background: var(--reaction-me-bg); border-color: var(--reaction-me-border); }
.reaction.me .reaction-count { color: var(--reaction-me-text); }

/* hover toolbar */
.toolbar {
  position: absolute;
  top: -25px;
  right: 14px;
  z-index: 2;
  display: none;
  grid-auto-flow: column;
  align-items: center;
  padding: 2px;
  background: var(--bg-surface-high);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}
.msg.group-start .toolbar { top: -16px; }
.msg:hover .toolbar, .toolbar.open { display: grid; }
.msg.editing .toolbar { display: none; }
.tb-btn { width: 28px; height: 28px; display: grid; place-items: center; padding: 2px; border-radius: 6px; color: var(--icon-subtle); }
.tb-btn:hover { background: var(--bg-mod-subtle); color: var(--text-strong); }
.tb-btn .emoji { width: 20px; height: 20px; margin: 0; vertical-align: 0; }
.tb-sep { width: 1px; height: 24px; margin: 2px 4px; border-radius: 100px; background: var(--border-subtle); }

/* inline edit */
/* inline edit (measured): composer-style box, 8px below the header, emoji button inside on the right */
.edit-wrap { display: flex; align-items: center; margin-top: 8px; padding-left: 15px; background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.edit-wrap .tool-btn { flex: none; margin: 0 12px 0 8px; }
.edit-ta {
  display: block;
  flex: 1;
  min-width: 0;
  padding: 17px 0;
  border: 0;
  background: transparent;
  color: var(--text-default);
  font: 16px/22px var(--font);
  resize: none;
  outline: none;
  overflow-y: auto;
}
.edit-hint { padding: 7px 0; font-size: 12px; line-height: 12px; color: var(--text-default); }
.edit-hint button { color: var(--text-link); }
.edit-hint button:hover { text-decoration: underline; }

/* ---------- composer ---------- */
.composer { position: relative; flex: none; margin-top: -16px; padding: 0 8px; }
.composer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 16px;
  top: 0;
  height: 16px;
  background: linear-gradient(rgba(26, 26, 30, 0), var(--bg-base-lower));
  pointer-events: none;
}
/* reply bar (measured): stacked on top of the input inside one bordered box, divided by a 1px line */
.reply-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 37px;
  padding: 3px 4px 0 16px;
  background: var(--bg-surface-higher);
  border: 1px solid var(--border-muted);
  border-bottom-color: var(--border-subtle);
  border-radius: 8px 8px 0 0;
  font-size: 14px;
  line-height: 18px;
  color: var(--text-default);
}
.reply-bar strong { font-weight: 600; color: var(--text-default); }
.reply-bar-close { width: 40px; height: 32px; display: grid; place-items: center; color: var(--icon-subtle); }
.reply-bar-close:hover { color: var(--text-strong); }
.input-box {
  position: relative;
  display: flex;
  align-items: flex-start;
  margin-bottom: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
}
.composer.has-reply .input-box { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.composer:focus-within .input-box, .composer:focus-within .reply-bar { border-color: var(--border-subtle); } /* measured: the box border brightens while typing */
.attach:hover, .tool-btn:hover { background: var(--bg-mod-strong); }
.input-tools .tool-btn[aria-label="Send a gift"]:hover { background: var(--brand); color: #fff; }
.attach { flex: none; width: 32px; height: 32px; margin: 12px 20px 0 11px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--icon-subtle); }
.attach:hover { color: var(--text-strong); }
.ta-wrap { flex: 1; min-width: 0; }
.ta-wrap textarea {
  display: block;
  width: 100%;
  max-height: 50vh;
  padding: 17px 10px 17px 0;
  border: 0;
  background: transparent;
  color: var(--text-default);
  font: 16px/22px var(--font);
  resize: none;
  outline: none;
  overflow-y: auto;
}
.ta-wrap textarea::placeholder { color: var(--text-placeholder); }
.input-tools { flex: none; display: flex; gap: 8px; padding: 12px 11px 0 0; }
.tool-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--icon-subtle); }
.tool-btn:hover { color: var(--text-strong); }
.gif-badge {
  padding: 3px 3px 2px;
  border-radius: 4px;
  background: var(--icon-subtle);
  color: var(--bg-input);
  font-size: 9px;
  font-weight: 800;
  line-height: 11px;
  letter-spacing: 0.02em;
}
.tool-btn:hover .gif-badge { background: var(--text-strong); }

.typing {
  position: absolute;
  left: 16px;
  right: 16px;
  top: -24px;
  height: 24px;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  line-height: 24px;
  color: var(--text-default);
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
}
.typing strong { font-weight: 700; color: var(--text-strong); }
.typing-dots { display: inline-flex; gap: 3px; margin: 0 6px 0 2px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-strong); animation: typing 1.4s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: 0.2s; }
.typing-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); } 30% { opacity: 1; transform: scale(1); } }

/* ==========================================================================
   Profile panel
   ========================================================================== */
.profile { flex: none; width: var(--profile-w); padding: 8px; display: flex; background: var(--bg-base-lower); }
.profile-card {
  flex: 1;
  min-width: 0;
  display: flex;
  padding: 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.profile-inner { flex: 1; min-width: 0; display: flex; flex-direction: column; border-radius: 6px; overflow: hidden; }
.profile-scroll { flex: 1; position: relative; overflow-y: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(#000 calc(100% - 16px), transparent); mask-image: linear-gradient(#000 calc(100% - 16px), transparent); }
.profile-scroll::-webkit-scrollbar { display: none; }
.profile-head { position: relative; height: 144px; margin-bottom: 8px; }
.profile-banner { height: 105px; }
.banner-buttons { position: absolute; top: 8px; right: 8px; display: flex; gap: 8px; }
.banner-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.56);
  color: #fff;
}
.banner-btn:hover { background: rgba(0, 0, 0, 0.72); }
.profile-avatar { position: absolute; left: 10px; top: 51px; padding: 6px; border-radius: 50%; background: var(--bg-input); cursor: pointer; }
.profile-bubble {
  position: absolute;
  left: 112px;
  top: 60px;
  max-width: 172px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--bg-surface-higher);
  border: 1px solid var(--border-subtle);
  color: var(--text-default);
  font-size: 13px;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-bubble .emoji { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.profile-body { margin: 0 16px; display: flex; flex-direction: column; gap: 20px; }
.profile-info { display: flex; flex-direction: column; gap: 8px; }
.profile-name { font-size: 20px; font-weight: 700; line-height: 24px; color: var(--text-default); }
.profile-tagrow { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; min-height: 24px; font-size: 14px; line-height: 18px; color: var(--text-strong); }
.dot { width: 4px; height: 4px; margin: 0 1px; border-radius: 50%; background: var(--text-default); }
.profile-mutuals { display: flex; align-items: center; gap: 6px; min-height: 24px; font-size: 12px; line-height: 16px; color: var(--text-subtle); }
.profile-mutuals .dot { margin: 0; background: var(--text-subtle); }
.mutual-link { display: flex; align-items: center; gap: 4px; padding: 4px 0; cursor: pointer; }
.mutual-link:hover { color: var(--text-strong); text-decoration: underline; }
.mutual-avatars { display: flex; }
.mutual-avatars .av { margin-right: -3px; -webkit-mask: radial-gradient(circle at calc(100% + 5px) 50%, transparent 9.5px, #000 10px); mask: radial-gradient(circle at calc(100% + 5px) 50%, transparent 9.5px, #000 10px); }
.mutual-avatars .av:last-child { margin-right: 0; -webkit-mask: none; mask: none; }
.profile-section { display: flex; flex-direction: column; gap: 8px; }
.ps-h { font-size: 12px; font-weight: 600; line-height: 16px; color: var(--text-strong); }
.ps-p { font-size: 14px; line-height: 18px; color: var(--text-default); }
.profile-footer { flex: none; padding: 16px; }
.btn-md {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: var(--bg-mod-subtle);
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
}
.btn-md:hover { background: var(--bg-mod-normal); }

@media (max-width: 1240px) {
  .profile { display: none; }
}

/* ==========================================================================
   Overlays: tooltip + emoji picker
   ========================================================================== */
.tooltip {
  position: fixed;
  z-index: 100;
  max-width: 260px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-high);
  box-shadow: inset 0 0 0 1px var(--border-subtle), 0 12px 24px rgba(0, 0, 0, 0.24);
  color: var(--text-default);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.1s ease-out, transform 0.1s ease-out;
}
.tooltip.show { opacity: 1; transform: none; }
.tooltip.big { font-size: 16px; font-weight: 600; line-height: 20px; }
/* caret: tooltip-coloured, outlined on its two slanted edges, overlapping the box by 2px (measured) */
.tip-caret { position: absolute; overflow: visible; fill: var(--bg-surface-high); stroke: var(--border-subtle); stroke-width: 1px; }
.tooltip.bottom .tip-caret { top: -8px; width: 16px; height: 10px; }
.tooltip.top .tip-caret { bottom: -8px; width: 16px; height: 10px; }
.tooltip.right .tip-caret { left: -8px; top: calc(50% - 8px); width: 10px; height: 16px; }

/* emoji picker (measured; see openPicker) */
.emoji-picker { position: fixed; z-index: 95; width: 498px; display: flex; flex-direction: column; border-radius: var(--radius-sm); background: var(--bg-surface-high); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 12px 24px rgba(0, 0, 0, 0.24); overflow: visible; }
.emoji-picker.ep-reaction, .emoji-picker.ep-plain { height: 509px; }
.emoji-picker.ep-composer { height: 486px; gap: 12px; padding-top: 16px; border: 1px solid var(--border-subtle); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24); }
.ep-nav { flex: none; display: flex; gap: 8px; padding: 0 16px; }
.ep-tab { height: 30px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text-default); font-size: 14px; font-weight: 600; line-height: 14px; }
.ep-tab:hover { background: var(--interactive-bg-hover); color: var(--text-strong); }
.ep-tab.active { background: var(--bg-mod-normal); color: var(--text-strong); }
.ep-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ep-header { flex: none; display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--border-subtle); border-radius: 8px 8px 0 0; }
.ep-composer .ep-header { padding-top: 0; }
.ep-search { flex: 1; min-width: 0; }
.ep-search .field-icon { color: var(--text-default); }
.ep-burst { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 16px; background: var(--bg-base-lowest); color: var(--text-default); }
.ep-burst:hover, .ep-burst.active { color: #fff; background: #4752c4; }
.ep-tone-wrap { position: relative; flex: none; }
.ep-tone { width: 38px; height: 38px; padding: 7px; display: grid; place-items: center; border-radius: var(--radius-sm); }
.ep-tone-img { width: 24px; height: 24px; }
.ep-tone-menu { position: absolute; top: 0; left: 0; z-index: 2; display: flex; flex-direction: column; padding: 0; border-radius: var(--radius-sm); background: var(--bg-surface-higher); box-shadow: 0 0 0 1px var(--border-subtle), 0 12px 24px rgba(0, 0, 0, 0.24); }
.ep-tone-menu .ep-tone:hover { background: var(--interactive-bg-hover); }
.ep-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 48px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 48px; border-radius: 0 0 8px 8px; overflow: hidden; }
.ep-cats { grid-row: 1 / 3; display: flex; flex-direction: column; min-height: 0; background: var(--bg-base-lower); }
.ep-cat-list { flex: 1; min-height: 0; padding: 8px 8px 0; overflow-y: auto; scrollbar-width: none; }
.ep-cat-list::-webkit-scrollbar { display: none; }
.ep-cat { position: relative; display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 8px; padding: 4px; border-radius: 4px; color: var(--icon-muted); }
.ep-cat:hover { color: var(--text-strong); }
.ep-cat.selected { background: var(--bg-base-low); color: var(--text-strong); }
.ep-cat.selected::before { content: ""; position: absolute; left: -8px; top: 4px; width: 4px; height: 24px; border-radius: 0 4px 4px 0; background: var(--text-strong); }
.ep-cat-shortcut { flex: none; height: 48px; display: grid; place-items: center; border-top: 1px solid var(--border-normal); background: var(--bg-base-lower); color: var(--icon-subtle); }
.ep-cat-shortcut:hover { color: var(--text-strong); }
.ep-list { position: relative; min-height: 0; padding-bottom: 8px; overflow-y: auto; scrollbar-gutter: stable; }
.ep-list.searching { padding-top: 8px; }
.ep-section { margin-bottom: 12px; }
.ep-sec-head { position: sticky; top: 0; z-index: 1; height: 32px; display: flex; align-items: center; padding: 0 4px 0 8px; background: var(--bg-surface-high); }
.ep-sec-toggle { display: flex; align-items: center; height: 18px; color: var(--text-default); font-size: 14px; font-weight: 600; line-height: 18px; }
.ep-sec-toggle span { margin: 0 4px; white-space: nowrap; }
.ep-sec-toggle:hover { color: var(--text-strong); }
.ep-sec-toggle .ic:last-child { transition: transform 0.1s ease-out; }
.ep-section.collapsed .ep-sec-toggle .ic:last-child { transform: rotate(-90deg); }
.ep-section.collapsed .ep-grid { display: none; }
.ep-grid { display: grid; grid-template-columns: repeat(9, 48px); padding-left: 8px; }
.ep-cell { width: 48px; height: 48px; padding: 4px; border-radius: 4px; }
.ep-cell.selected { background: var(--interactive-bg-selected); }
.ep-img { display: block; width: 40px; height: 40px; object-fit: contain; }
.ep-empty { padding: 32px 16px; color: var(--text-muted); font-size: 14px; text-align: center; }
.ep-inspector { display: flex; align-items: center; min-width: 0; padding: 0 16px; border-top: 1px solid var(--border-normal); background: var(--bg-base-lower); }
.ep-ins-img { flex: none; width: 28px; height: 28px; object-fit: contain; }
.ep-ins-name { min-width: 0; margin-left: 8px; color: var(--text-default); font-size: 16px; font-weight: 600; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================
   Message context menu (right-click), measured from the live client
   ========================================================================== */
.ctx-menu {
  position: fixed;
  z-index: 60;
  display: flex;
  max-width: 320px;
  max-height: calc(100vh - 32px);
  background: var(--bg-surface-higher);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
  cursor: default;
  user-select: none;
}
.ctx-menu.submenu { z-index: 61; min-width: 188px; max-height: 360px; }
.ctx-scroller { flex: 1; min-width: 0; padding: 8px 0 8px 8px; }
.ctx-quick { display: grid; grid-template-columns: repeat(4, 44px); gap: 4px; padding: 8px; }
.ctx-quick button { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--bg-mod-subtle); }
.ctx-quick button.focused { background: var(--bg-mod-strong); }
.ctx-quick .emoji { width: 20px; height: 20px; margin: 0; vertical-align: 0; }
.ctx-item {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 8px;
  border-radius: 2px;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  cursor: pointer;
}
.ctx-icon { flex: none; display: flex; width: 20px; height: 20px; margin-right: 8px; color: var(--icon-subtle); }
.ctx-icon .emoji { width: 20px; height: 20px; margin: 0; vertical-align: 0; }
.ctx-label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-caret { flex: none; display: flex; margin-left: 8px; color: var(--text-muted); }
.ctx-item.focused { background: var(--interactive-bg-hover); border-radius: 4px; }
.ctx-item.focused .ctx-icon, .ctx-item.focused .ctx-caret { color: var(--text-strong); }
.ctx-item.danger, .ctx-item.danger .ctx-icon { color: #f87e7a; }
.ctx-item.danger.focused { background: rgba(210, 45, 57, 0.08); }
.ctx-sep { height: 0; margin: 8px 0; border-bottom: 1px solid var(--border-subtle); }

/* the right-clicked message stays highlighted, with its toolbar showing, while the menu is open */
.msg.ctx-open { background: var(--message-bg-hover); }
.msg.ctx-open .toolbar { display: grid; }

/* submenu parts: section labels, the Apps search row, trailing icons, app avatars */
.ctx-item[hidden] { display: none; }
.ctx-group { padding: 8px; color: var(--text-muted); font-size: 14px; font-weight: 500; line-height: 20px; cursor: default; }
.ctx-search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.12);
  color: var(--text-default);
}
.ctx-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text-default); font: 500 14px/18px var(--font); outline: none; }
.ctx-search input::placeholder { color: var(--text-input-placeholder); }

.ctx-trail { flex: none; display: flex; margin-left: 8px; color: var(--icon-subtle); }
.ctx-item.focused .ctx-trail { color: var(--text-strong); }
.app-icon { width: 20px; height: 20px; border-radius: 50%; }

/* ==========================================================================
   Message extras: NEW divider, forwards, quotes, app replies, pin notices
   ========================================================================== */
.divider.unread { border-top-color: var(--badge-red); }
.divider.unread .date { color: var(--badge-red); }
.divider.bare { margin-top: 8px; margin-bottom: 0; }
.divider .new-pill {
  position: absolute;
  right: 0;
  top: 0;
  height: 13px;
  padding: 0 4px 0 2px;
  border-radius: 0 4px 4px 0;
  background: var(--badge-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 13px;
  text-transform: uppercase;
  transform: translateY(-50%);
}
.divider .new-pill::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 0;
  border-style: solid;
  border-width: 6.5px 5px 6.5px 0;
  border-color: transparent var(--badge-red) transparent transparent;
}

.fwd { position: relative; margin: 2px 0; padding-left: 12px; }
.fwd::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: 4px; background: rgba(151, 151, 159, 0.44); }
.fwd-head { display: flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 14px; font-style: italic; line-height: 18px; }
.fwd-foot { margin-top: 4px; color: var(--text-muted); font-size: 12px; line-height: 16px; }

.bq { display: flex; }
.bq::before { content: ""; flex: none; width: 4px; border-radius: 4px; background: rgba(151, 151, 159, 0.44); }
.bq blockquote { margin: 0; padding: 0 8px 0 12px; max-width: 90%; }
.reply-text .bq, .reply-text .bq blockquote { display: inline; padding: 0; }
.reply-text .bq::before { display: none; }

.app-tag {
  display: inline-block;
  height: 15px;
  margin-right: 4px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 15px;
  vertical-align: 2px;
}
.reply-ref.interaction { cursor: default; }
.reply-ref .cmd { color: var(--text-link); }

.msg.system .sys-icon { position: absolute; left: 28px; top: 7px; color: var(--text-muted); }
.sys-text { padding: 2px 0; color: var(--text-channels); font-size: 16px; line-height: 22px; }
.sys-strong { color: var(--text-strong); font-weight: 500; }
.sys-link { color: var(--text-strong); font-weight: 500; cursor: pointer; }
.sys-link:hover { text-decoration: underline; }

/* ==========================================================================
   Dialogs: Forward ("md") and Report ("sm") were measured from the live client
   ========================================================================== */
.modal-layer { position: fixed; inset: 0; z-index: 80; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); animation: fade-in 0.15s ease-out; }
.modal-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 56px 24px; pointer-events: none; }
.modal {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  background: var(--bg-surface-high);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
  pointer-events: auto;
  animation: modal-in 0.15s ease-out;
}
.modal:focus { outline: none; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: scale(0.96); } }
.modal-title { color: var(--text-strong); font-size: 20px; font-weight: 600; line-height: 24px; }
.modal-sub { color: var(--text-subtle); font-size: 16px; line-height: 20px; }
.modal-close { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--icon-subtle); }
.modal-close:hover { background: var(--bg-mod-normal); color: var(--text-strong); }

/* small dialog (Report, Delete, Custom Reminder) */
.modal.sm { width: 444px; max-height: min(662px, 100%); border: 1px solid var(--border-normal); }
.modal.sm > .modal-close { position: absolute; top: 8px; right: 10px; }
.sm-head { padding: 24px 24px 0; }
.sm-sub { margin-top: 8px; padding: 0 24px; }
.sm-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px; padding: 24px 18px 24px 24px; }
.sm-section-h { display: block; margin-bottom: 8px; color: var(--text-default); font-size: 14px; font-weight: 600; line-height: 18px; }
.sm-text { color: var(--text-default); font-size: 16px; line-height: 20px; }
.sm-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 24px 24px; }
.msg-preview { padding: 16px 16px 16px 0; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.preview-msg { position: relative; min-height: 48px; padding: 2px 16px 2px 72px; }
.report-list { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius-md); }
.report-option {
  display: flex;
  align-items: center;
  width: 100%;
  border-bottom: 1px solid var(--border-muted);
  background: var(--bg-mod-subtle);
  color: var(--text-default);
  font-size: 16px;
  line-height: 20px;
  text-align: left;
  text-decoration: none;
}
.report-option:last-child { border-bottom: 0; }
.report-option:hover { background: var(--bg-mod-normal); text-decoration: none; }
.report-option span { flex: 1; margin: 8px 0 8px 16px; padding: 12px 0; }
a.report-option span { padding: 4px 0; }
.report-option .ic { margin: 0 16px 0 8px; color: var(--icon-subtle); }
.protip { color: var(--text-subtle); font-size: 14px; line-height: 18px; }
.protip strong:first-child { margin-right: 4px; color: var(--status-online); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.field-error { margin-top: -8px; color: #f87e7a; font-size: 14px; line-height: 18px; }

/* medium dialog (Forward) */
.modal.md { width: 480px; padding: 8px 0 16px; border: 1px solid var(--border-subtle); }
.md-head { display: flex; flex-direction: column; gap: 8px; padding: 16px 24px 8px; }
.md-title-row { display: flex; align-items: flex-start; }
.md-title-row .modal-title { flex: 1; min-width: 0; }
.md-title-row .modal-close { margin: -16px -16px 0 12px; }
.md-search { padding: 16px 24px 0; }
.md-list { flex: 1 1 auto; min-height: 0; padding: 12px 8px 12px 24px; overflow-y: auto; scrollbar-gutter: stable; }
.md-list-end { padding-bottom: 8px; border-top: 1px solid var(--border-subtle); }
.dest-row { display: flex; align-items: center; height: 48px; margin: 0 -8px; padding: 0 8px; border-radius: var(--radius-sm); cursor: pointer; }
.dest-row[hidden] { display: none; }
.dest-row:hover { background: var(--interactive-bg-hover); }
.dest-identity { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.dest-labels { min-width: 0; display: flex; flex-direction: column; margin: 4px 0; }
.dest-labels strong, .dest-labels span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dest-labels strong { color: var(--text-default); font-size: 16px; font-weight: 600; line-height: 20px; }
.dest-labels span { color: var(--text-muted); font-size: 12px; line-height: 16px; }
.checkbox {
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: 16px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(151, 151, 159, 0.64);
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.08);
  color: transparent;
}
.dest-row.selected .checkbox, .dest-row.checked .checkbox, .friend-row.checked .checkbox { border-color: var(--border-subtle); background: var(--brand); color: #fff; }
.fwd-preview { position: relative; margin: 16px 24px 0; padding: 4px 0 4px 16px; }
.fwd-preview::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: 4px; background: rgba(151, 151, 159, 0.44); }
.fwd-preview-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--text-default);
  font-size: 16px;
  line-height: 22px;
}
.md-actions { display: flex; gap: 8px; padding: 16px 24px 8px; }
/* confirmation dialogs + Set Custom Reminder (measured): body sits between a 16px top and 8px bottom spacer */
.md-body { flex: 1 1 auto; min-height: 0; padding: 16px 24px 8px; }
.msg-preview.raised { padding: 10px 0; border: 0; border-radius: 3px; background: var(--bg-base-low); box-shadow: 0 0 0 1px rgba(30, 31, 34, 0.6), 0 2px 10px rgba(0, 0, 0, 0.2); overflow: hidden; }
.protip-block { margin-top: 20px; }
.protip-block .pro { color: #5eb479; font-size: 14px; font-weight: 700; line-height: 18px; text-transform: uppercase; }
.protip-block .tip { color: var(--text-default); font-size: 14px; line-height: 16px; }
.protip-block .tip strong { font-weight: 600; }
.double-input { display: flex; gap: 8px; }
.form-item { flex: 1; min-width: 0; }
.form-label { display: block; margin-bottom: 8px; color: var(--text-strong); font-size: 16px; font-weight: 500; line-height: 20px; }
.form-label .req { margin-left: 4px; color: #f87e7a; font-weight: 400; }
.picker-input { position: relative; gap: 8px; padding: 8px 12px; color: var(--text-default); cursor: pointer; }
.picker-input .pi-value { flex: 1; min-width: 0; font-size: 16px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-input input[type="date"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.select-field { position: relative; cursor: pointer; }
.select-field .pi-value { flex: 1; min-width: 0; padding: 1px 8px 1px 12px; color: var(--text-default); font-size: 16px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select-field .pi-value.placeholder { color: var(--text-input-placeholder); }
.select-chevron { flex: none; width: 36px; height: 38px; display: grid; place-items: center; padding-right: 4px; color: var(--text-strong); }
.select-popout { position: absolute; left: -1px; right: -1px; top: calc(100% + 4px); z-index: 5; max-height: 240px; padding: 4px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-surface-higher); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24); overflow-y: auto; }
.select-option { padding: 8px; border-radius: 4px; color: var(--text-default); font-size: 14px; font-weight: 500; line-height: 18px; }
.select-option:hover { background: var(--interactive-bg-hover); color: var(--text-strong); }
.select-option.selected { background: var(--interactive-bg-selected); color: var(--text-strong); }
.md-body .field-error { margin-top: 8px; }

/* inputs and buttons used inside dialogs */
.field {
  display: flex;
  align-items: center;
  height: 40px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.12);
}
.field:focus-within, .ctx-search:focus-within, .af-field:focus-within { border-color: var(--brand); outline: 2px solid var(--brand); outline-offset: -2px; } /* measured focus ring */
.field input { flex: 1; min-width: 0; height: 100%; padding: 1px 12px 1px 0; border: 0; background: transparent; color: var(--text-default); font: 16px/20px var(--font); outline: none; }
.field input::placeholder { color: var(--text-input-placeholder); }
.field.has-leading { padding-left: 4px; }
.field.plain { padding-left: 12px; }
.field-icon { flex: none; width: 30px; height: 30px; display: grid; place-items: center; color: var(--text-default); }
.fwd-note { flex: 1; min-width: 0; padding-left: 16px; }
.fwd-note input::placeholder { color: var(--text-placeholder); }
.field-btn { flex: none; width: 32px; height: 32px; margin-right: 4px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--icon-subtle); }
.field-btn:hover { color: var(--text-strong); }
.mbtn {
  flex: none;
  min-width: 100px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 15px;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
}
.mbtn.primary { border-color: rgba(255, 255, 255, 0.08); background: var(--brand); color: #fff; }
.mbtn.primary:not(:disabled):hover { background: #4752c4; }
.mbtn.secondary { background: var(--bg-mod-subtle); color: var(--text-strong); }
.mbtn.secondary:not(:disabled):hover { background: var(--bg-mod-normal); }
.mbtn.danger { border-color: rgba(255, 255, 255, 0.08); background: var(--badge-red); color: #fff; }
.mbtn.danger:not(:disabled):hover { background: #b3242f; }
.mbtn:disabled { opacity: 0.5; cursor: not-allowed; }

/* friend picker: New Message + Add to DM (measured) */
.field.tags { flex-wrap: wrap; gap: 4px; height: auto; min-height: 42px; padding: 4px; }
.field.tags input { flex: 1 1 80px; height: 32px; padding: 1px 12px 1px 8px; }
.tag-list { display: contents; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  margin: 4px 0 4px 4px;
  padding: 0 6px 0 8px;
  border-radius: var(--radius-xs);
  background: var(--bg-mod-strong);
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
}
.tag:hover { background: var(--border-strong); }
.field-help { margin-top: 4px; color: var(--text-subtle); font-size: 12px; line-height: 16px; }
.friend-row { display: flex; align-items: center; gap: 8px; height: 48px; margin: 0 -8px; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; }
.friend-row[hidden] { display: none; }
.friend-row.hl { background: rgba(79, 80, 90, 0.3); }
.friend-row.locked, .friend-row.disabled { opacity: 0.5; cursor: not-allowed; }
.friend-labels { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.friend-labels strong, .friend-labels span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-labels strong { color: var(--text-default); font-size: 16px; font-weight: 500; line-height: 20px; }
.friend-labels span { color: var(--text-muted); font-size: 12px; line-height: 16px; }
.friend-row .checkbox { margin-left: 0; }
.md-actions.split > .mbtn, .md-actions.full > .mbtn { flex: 1; }

/* Clean Up Inactive Group DMs (measured) */
.list-controls { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px 0; }
.sort-trigger { display: flex; align-items: center; gap: 4px; color: var(--text-subtle); font-size: 14px; font-weight: 500; line-height: 18px; }
.sort-trigger:hover { color: var(--text-strong); }
.text-btn { color: #798df9; font-size: 14px; font-weight: 500; line-height: 18px; }
.text-btn:hover { text-decoration: underline; }
.text-btn[hidden] { display: none; }
.md-empty { padding: 24px 0; color: var(--text-muted); font-size: 14px; text-align: center; }

.scroll-auto::-webkit-scrollbar { width: 16px; }
.scroll-auto::-webkit-scrollbar-track { background: transparent; }
.scroll-auto::-webkit-scrollbar-thumb { min-height: 40px; background-color: var(--scroll-auto-thumb); border: 4px solid transparent; background-clip: padding-box; border-radius: 8px; }

/* ==========================================================================
   Pinned Messages popout (measured; the pinned-message cards are best guess)
   ========================================================================== */
.popout { position: fixed; z-index: 70; }
.pins {
  width: 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-high);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 12px 24px rgba(0, 0, 0, 0.24);
  animation: fade-in 0.1s ease-out;
}
.pins-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 16px; border-bottom: 1px solid var(--border-subtle); color: var(--text-strong); }
.pins-head h2 { font-size: 20px; font-weight: 600; line-height: 24px; }
.pins-list { flex: 1 1 auto; min-height: 0; padding: 8px 0 0 8px; }
.pins-empty { display: flex; flex-direction: column; align-items: center; margin: 8px 0 32px; }
.pins-empty p { max-width: 240px; margin-top: 20px; color: var(--text-default); font-size: 16px; font-weight: 500; line-height: 20px; text-align: center; }
.pins-foot { flex: none; padding: 16px; background: var(--bg-mod-subtle); }
.pins-protip { padding: 10px 0; text-align: center; }
.pins-protip .pro { color: #5eb479; font-size: 14px; font-weight: 700; line-height: 18px; text-transform: uppercase; }
.pins-protip .tip { color: var(--text-default); font-size: 14px; line-height: 16px; }
.pin-card { position: relative; margin: 0 8px 8px 0; padding: 8px 0; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-base-lower); }
.pin-card .preview-msg { padding-right: 16px; }
.pin-actions { position: absolute; top: 8px; right: 8px; display: none; align-items: center; gap: 4px; }
.pin-card:hover .pin-actions { display: flex; }
.pin-jump { height: 24px; padding: 0 8px; border-radius: var(--radius-xs); background: var(--bg-mod-strong); color: var(--text-strong); font-size: 12px; font-weight: 600; }
.pin-jump:hover { background: var(--border-strong); }
.pin-unpin { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-mod-strong); color: var(--icon-subtle); }
.pin-unpin:hover { color: var(--text-strong); }

/* group DMs: member list (measured), stacked avatars, "added to the group" notices */
.profile.members { width: 265px; padding: 0; border-left: 1px solid var(--border-subtle); }
.members-panel { flex: 1; min-width: 0; padding: 0 0 10px; background: var(--bg-base-lower); }
.members-h { height: 42px; padding: 20px 4px 4px 16px; color: var(--text-channels); font-size: 14px; font-weight: 500; line-height: 18px; }
.member-row { width: 248px; height: 42px; margin-left: 8px; padding: 1px 0; cursor: pointer; }
.member-row.offline { opacity: 0.3; }
.member-row:hover { opacity: 1; }
.member-inner { display: flex; align-items: center; height: 40px; padding: 0 8px; border-radius: var(--radius-sm); color: var(--text-channels); }
.member-inner .av { margin-right: 12px; }
.member-row:hover .member-inner { background: var(--interactive-bg-hover); color: var(--text-strong); }
.member-name { min-width: 0; font-size: 16px; font-weight: 500; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-inner .owner { display: flex; margin-left: 4px; color: var(--status-idle); }
.members-invite {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 232px;
  height: 40px;
  margin: 16px 0 0 16px;
  padding: 7px 15px;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: var(--bg-mod-subtle);
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
}
.members-invite:hover { background: var(--bg-mod-normal); }

/* Invite to Group DM (measured): search + inline Add, invite-link footer; "The party is full!" body */
.md-search.inline { display: flex; align-items: flex-start; gap: 8px; }
.picker-field { flex: 1; min-width: 0; }
.md-search.inline .mbtn { min-width: 100px; }
.md-actions.invite { padding-right: 32px; }
.invite-block { flex: 1; min-width: 0; }
.invite-label { display: block; margin-bottom: 8px; color: var(--text-strong); font-size: 16px; font-weight: 500; line-height: 20px; }
.copy-input { display: flex; align-items: center; height: 40px; border: 1px solid var(--border-normal); border-radius: var(--radius-sm); background: rgba(0, 0, 0, 0.12); }
.copy-input input { flex: 1; min-width: 0; height: 38px; margin-right: 10px; padding: 10px 0 10px 10px; border: 0; background: transparent; color: var(--text-default); font: 16px/18px var(--font); outline: none; }
.copy-btn { flex: none; height: 30px; margin: 4px; padding: 2px 20px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--radius-xs); background: var(--brand); color: #fff; font-size: 14px; font-weight: 500; line-height: 16px; }
.copy-btn:hover { background: #4752c4; }
.copy-btn.copied { background: #248046; }
.md-body-text { padding: 16px 24px 8px; color: var(--text-default); font-size: 16px; line-height: 16px; }
.av.group img, .welcome-avatar.group { border-radius: 0; }

/* ==========================================================================
   Friends page (header, list and Active Now measured; Add Friend tab best guess)
   ========================================================================== */
.ch-icon { flex: none; display: flex; width: 32px; height: 32px; align-items: center; justify-content: center; color: var(--text-channels); }
.ch-left .ch-icon { margin-left: 0; }
.friends-head .ch-name { flex: none; margin: 0 8px 0 0; }
.head-dot { flex: none; width: 4px; height: 4px; margin: 0 4px; border-radius: 50%; background: var(--border-normal); }
.tab-bar { display: flex; align-items: center; }
.tab { height: 32px; margin: 0 8px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--text-subtle); font-size: 16px; font-weight: 500; line-height: 20px; }
.tab:hover { background: var(--interactive-bg-hover); color: var(--text-strong); }
.tab.selected { background: var(--bg-mod-strong); color: var(--text-strong); }
.tab.add-friend { background: var(--brand); color: #fff; }
.tab.add-friend:hover { background: #4752c4; }
.tab.add-friend.selected { background: rgba(88, 101, 242, 0.16); color: #798df9; }
.friends-page { flex: 1; min-width: 0; display: flex; }
.people-column { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.people-column.scroll-auto { overflow-y: auto; }
.people-search { flex: none; margin: 12px 16px 8px 24px; }
.people-list { flex: 1; min-height: 0; overflow-y: scroll; padding-bottom: 8px; }
.people-title { margin: 16px 20px 16px 24px; color: var(--text-default); font-size: 14px; font-weight: 500; line-height: 18px; }
.people-divider { height: 1px; margin: 0 20px 0 30px; background: var(--border-subtle); }
.people-row { display: flex; align-items: center; height: 61px; margin: 0 10px 0 14px; padding: 0 10px; border-radius: var(--radius-sm); cursor: pointer; }
.people-row:hover { background: var(--interactive-bg-hover); }
.people-user { flex: 1; min-width: 0; display: flex; align-items: flex-start; } /* avatar lines up with the top of the name */
.people-row .av { margin-right: 12px; }
.people-text { flex: 1; min-width: 0; }
.people-name { display: flex; align-items: baseline; min-width: 0; }
.people-name .pn { color: var(--text-strong); font-size: 16px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.people-name .pu { margin-left: 5px; color: var(--text-default); font-size: 14px; font-weight: 500; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; visibility: hidden; }
.people-row:hover .pu { visibility: visible; }
.people-sub { color: var(--text-muted); font-size: 14px; font-weight: 500; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.people-sub .emoji { width: 16px; height: 16px; margin: 0 4px 0 0; vertical-align: -3px; }
.people-actions { flex: none; display: flex; gap: 10px; margin-left: 8px; }
.action-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-base-lower); color: var(--icon-subtle); }
.people-row:hover .action-btn { background: var(--bg-base-lowest); }
.action-btn:hover { color: var(--text-strong); }
.people-empty { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 64px 24px; color: var(--text-muted); text-align: center; }
.people-empty .ic { color: var(--text-placeholder); }
.people-empty p { font-size: 16px; line-height: 20px; }

.active-now { flex: none; width: 420px; padding: 6px 8px 16px 16px; border-left: 1px solid var(--border-subtle); background: var(--bg-base-lower); }
.active-now h2 { margin: 8px 0 0; color: var(--text-strong); font-size: 20px; font-weight: 600; line-height: 24px; }
.an-card { margin-top: 12px; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 16px; background: var(--bg-base-low); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14); }
.an-head { display: grid; grid-template-columns: 32px 1fr 24px; align-items: center; gap: 12px; padding: 16px; background: rgba(151, 151, 159, 0.08); }
.an-body { display: grid; grid-template-columns: 32px 1fr 24px; align-items: center; gap: 12px; padding: 16px; }
.an-text { min-width: 0; }
.an-name, .an-game { color: var(--text-default); font-size: 16px; font-weight: 600; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-game { font-size: 14px; line-height: 18px; }
.an-sub { color: var(--text-muted); font-size: 14px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-sub.small { font-size: 12px; line-height: 16px; }
.an-icon { display: flex; color: var(--icon-subtle); }
.an-game-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--bg-mod-strong); color: var(--text-default); }
.an-empty { padding: 16px; text-align: center; }
.an-empty h3 { margin-bottom: 4px; color: var(--text-default); font-size: 16px; font-weight: 600; line-height: 20px; }
.an-empty p { color: var(--text-muted); font-size: 14px; line-height: 18px; }

/* Add Friend tab (measured) */
.af-header { padding: 20px 30px; border-bottom: 1px solid var(--border-subtle); }
.af-header.other { display: flex; flex-direction: column; gap: 8px; border-bottom: 0; }
.af-title { margin-bottom: 8px; color: var(--text-strong); font-size: 20px; font-weight: 600; line-height: 24px; }
.af-header.other .af-title { margin: 0; }
.af-desc { color: var(--text-default); font-size: 16px; line-height: 20px; }
.add-friend-form > .af-desc { padding-right: 128px; }
.af-box { margin-top: 16px; padding: 0 12px; border: 1px solid var(--border-normal); border-radius: 16px; background: rgba(0, 0, 0, 0.12); }
.af-box:focus-within { border-color: var(--brand); }
.add-friend-form.success .af-box { border-color: #5eb479; }
.add-friend-form.error .af-box { border-color: #f87e7a; }
.af-row { display: flex; align-items: center; padding: 2px 0; }
.af-input { flex: 1; min-width: 0; height: 44px; margin: 4px 16px 4px 0; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-default); font: 500 16px/20px var(--font); outline: none; }
.af-input::placeholder, .af-note-ta::placeholder { color: var(--text-input-placeholder); }
.mbtn.sm { min-width: 0; height: 32px; padding: 3px 11px; font-size: 14px; line-height: 18px; }
.af-note { padding: 12px 0; border-top: 1px solid var(--border-subtle); }
.af-note-ta { display: block; width: 100%; height: 41px; padding: 0; border: 0; background: transparent; color: var(--text-default); font: 500 16px/20px var(--font); resize: none; outline: none; }
.af-count { display: flex; justify-content: flex-end; padding-top: 4px; color: var(--text-subtle); font-size: 14px; line-height: 18px; }
.af-help { margin-top: 8px; color: var(--text-subtle); font-size: 14px; line-height: 18px; }
.af-result { margin-top: 8px; font-size: 14px; line-height: 18px; }
.add-friend-form.success .af-result { color: #5eb479; }
.add-friend-form.error .af-result { color: #f87e7a; }
.af-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 32px; padding: 0 20px; }
.af-explore { display: flex; align-items: center; height: 56px; padding: 1px 6px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-base-lower); color: var(--text-default); font-size: 16px; font-weight: 500; line-height: 20px; text-align: left; }
.af-explore:hover { background: var(--interactive-bg-hover); }
.af-explore-icon { flex: none; width: 36px; height: 36px; margin: 8px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--status-online); color: #000; }
.af-explore-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.af-explore > .ic { margin-right: 16px; color: var(--text-subtle); }
.msg.system.add .sys-icon, .msg.system.join .sys-icon { color: var(--status-online); }
.sys-user { cursor: pointer; }
.sys-user:hover { text-decoration: underline; }
.sys-wave { display: flex; align-items: center; gap: 8px; height: 32px; margin: 6px 0 2px; padding: 0 12px 0 8px; border: 1px solid rgba(151, 151, 159, 0.04); border-radius: var(--radius-sm); background: var(--bg-mod-subtle); color: var(--text-strong); font-size: 14px; font-weight: 500; line-height: 18px; }
.sys-wave:hover { background: var(--bg-mod-normal); }
.sys-wave-hand { font-size: 20px; line-height: 1; }

/* ==========================================================================
   Toasts (bookmark, reminder, forward confirmations)
   ========================================================================== */
.toasts { position: fixed; left: 50%; bottom: 96px; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 460px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-higher);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  pointer-events: auto;
  animation: toast-in 0.15s ease-out;
  transition: opacity 0.15s, transform 0.15s;
}
.toast.leaving { opacity: 0; transform: translateY(4px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(4px); } }
.toast-icon { display: flex; color: var(--icon-subtle); }
.toast-text { min-width: 0; display: flex; flex-direction: column; }
.toast-text strong { font-weight: 600; }
.toast-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast-action { flex: none; padding: 4px 10px; border-radius: 6px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 500; }
.toast-action:hover { background: #4752c4; }
.toast-close { flex: none; display: grid; color: var(--icon-subtle); }
.toast-close:hover { color: var(--text-strong); }

/* ==========================================================================
   Preferences (Settings) applied to the page
   ========================================================================== */
.msg-content { font-size: var(--chat-font-size, 16px); line-height: 1.375; }
.msg.group-start { margin-top: calc(var(--group-gap, 16px) + 1px); }
html.desaturate .app, html.desaturate .st-layer { filter: saturate(var(--saturation, 1)); }
html.underline-links a { text-decoration: underline; }
html.hide-reactions .reactions { display: none; }
html.reduced-motion *, html.reduced-motion *::before, html.reduced-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
/* Ash / Onyx / Light are approximations (only Dark was measured) */
html.theme-ash { --bg-base-lowest: #26262b; --bg-base-lower: #2f3035; --bg-base-low: #35363c; --bg-surface-high: #393a40; --bg-surface-higher: #3f4046; --bg-input: #393a40; }
html.theme-onyx { --bg-base-lowest: #000; --bg-base-lower: #08080a; --bg-base-low: #0e0e11; --bg-surface-high: #141417; --bg-surface-higher: #19191d; --bg-input: #121215; }
html.theme-light {
  color-scheme: light;
  --bg-base-lowest: #eeeef0; --bg-base-lower: #fbfbfb; --bg-base-low: #f3f3f5; --bg-surface-high: #ffffff; --bg-surface-higher: #ffffff; --bg-input: #ebebee;
  --text-strong: #070709; --text-default: #2d2e33; --text-subtle: #4f5058; --text-muted: #5d5e66; --text-channels: #6a6b73; --text-placeholder: #898a92; --text-input-placeholder: #77787f;
  --icon-muted: #5d5e66; --icon-subtle: #4f5058; --text-code: #2d2e33; --spine: #c4c4ca; --scroll-auto-thumb: #c4c4ca; --scroll-thin-thumb: #c4c4ca;
}
html.theme-light .composer::before { background: linear-gradient(rgba(251, 251, 251, 0), var(--bg-base-lower)); }
html.theme-light { --reaction-me-text: #3c45a5; }
html.theme-light .up-btn { color: var(--icon-subtle); }
html.theme-light .tb-center img { filter: brightness(0) opacity(0.75); } /* the logo is white on transparent */

/* ==========================================================================
   Slider (measured: 4px bar, 16px grabber, track inset 5px); used in Settings and the voice menus
   ========================================================================== */
.ui-slider { position: relative; height: 24px; cursor: pointer; touch-action: none; outline: none; }
.ui-slider-bar { position: absolute; left: 0; right: 0; top: 10px; height: 4px; overflow: hidden; border-radius: 4px; background: #474851; }
.ui-slider-fill { width: var(--pct); height: 100%; background: var(--brand); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.ui-slider-track { position: absolute; left: 5px; right: 5px; top: 0; bottom: 0; }
.ui-slider-grabber { position: absolute; z-index: 1; left: var(--pct); top: 12px; width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 1px solid var(--border-normal); border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14); }
.ui-slider:focus-visible .ui-slider-grabber { outline: 2px solid #6aa8f4; outline-offset: 1px; }
.ui-slider.sensitivity .ui-slider-bar { background: var(--status-online); }
.ui-slider.sensitivity .ui-slider-fill { background: var(--status-idle); }

/* ==========================================================================
   Input / Output Options menus (measured): 222px wide, 4px above the buttons
   ========================================================================== */
.ctx-menu.voice-menu { width: 222px; max-width: 222px; }
.ctx-item.tall { min-height: 52px; }
.ctx-label-2 { display: flex; flex-direction: column; }
.ctx-subtext { margin-top: 2px; color: var(--text-muted); font-size: 12px; font-weight: 400; line-height: 16px; }
.ctx-radio { position: relative; flex: none; width: 20px; height: 20px; margin-left: 8px; border: 1px solid rgba(151, 151, 159, 0.6); border-radius: 50%; background: rgba(0, 0, 0, 0.1); }
.ctx-radio.on, .st-radio.on .st-radio-dot { border-color: var(--brand); background: var(--brand); }
.ctx-radio.on::after, .st-radio.on .st-radio-dot::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #fff; }
.ctx-slider-item { cursor: default; }
.ctx-slider-label { padding: 8px; color: var(--text-strong); font-size: 14px; font-weight: 500; line-height: 18px; }
.ctx-slider-wrap { padding: 0 8px; }
.up-btn.chevron.open { background: var(--bg-mod-normal); color: var(--text-strong); }
.up-btn.chevron .ic { transition: transform 0.15s ease-out; }
.up-btn.chevron.open .ic { transform: rotate(180deg); }
.av.s48 { width: 48px; height: 48px; }

/* ==========================================================================
   User Settings window (measured from the live client's 2025 settings)
   ========================================================================== */
.st-layer { position: fixed; inset: 0; z-index: 75; }
.st-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); animation: fade-in 0.15s ease-out; }
.st-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 72px; pointer-events: none; }
.st-modal { display: flex; width: min(1400px, 100%); height: 100%; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-base-lower); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24); pointer-events: auto; animation: modal-in 0.15s ease-out; }
.st-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* sidebar */
.st-side { flex: none; width: 253px; display: flex; flex-direction: column; padding: 16px 0 0 12px; border-right: 1px solid var(--border-muted); background: var(--bg-base-lower); }
.st-side-top { flex: none; padding: 0 16px 0 4px; }
.st-user { width: 220px; height: 64px; display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding: 8px; border-radius: var(--radius-sm); text-align: left; }
.st-user:hover { background: var(--interactive-bg-hover); }
.st-user-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st-user-name { color: var(--text-strong); font-size: 16px; font-weight: 500; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-user-edit { display: flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 14px; line-height: 18px; }
.st-side-search { width: 220px; }
.st-nav { flex: 1; min-height: 0; margin-right: 4px; padding: 12px 4px 16px; overflow-y: auto; }
.st-nav-sections { display: flex; flex-direction: column; gap: 8px; }
.st-nav-section { position: relative; display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--border-subtle); }
.st-nav-section:last-child { border-bottom: 0; }
.st-nav-label h3 { margin: 8px 8px 4px; color: var(--text-muted); font-size: 14px; font-weight: 500; line-height: 18px; }
.st-nav-list { display: flex; flex-direction: column; gap: 4px; }
.st-nav-item { width: 100%; height: 36px; display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 16px; font-weight: 500; line-height: 20px; text-align: left; }
.st-nav-item:hover { background: var(--interactive-bg-hover); color: var(--text-strong); }
.st-nav-item.active { background: var(--bg-mod-normal); color: var(--text-strong); }
.st-nav-item.destructive { color: #f87e7a; }
.st-nav-item.destructive:hover { background: rgba(210, 45, 57, 0.08); }
.st-subnav { position: relative; display: flex; flex-direction: column; gap: 16px; margin-left: 17px; padding: 8px 0 8px 19px; }
.st-subnav-track { position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 1px; background: var(--bg-mod-subtle); }
.st-subnav-thumb { position: absolute; left: 0; top: 0; width: 2px; height: 20px; border-radius: 2560px; background: var(--text-strong); transition: transform 0.15s ease-out; }
.st-subnav-item { height: 20px; overflow: hidden; color: var(--text-muted); font-size: 16px; line-height: 20px; text-align: left; white-space: nowrap; text-overflow: ellipsis; }
.st-subnav-item:hover, .st-subnav-item.active { color: var(--text-strong); }
.st-footer { display: flex; flex-direction: column; gap: 4px; padding: 24px 0 0; color: var(--text-muted); font-size: 10px; line-height: 12px; }
.st-footer-links { display: flex; align-items: center; }
.st-footer-links i { margin: 0 4px; font-style: normal; }

/* content */
.st-content { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-base-low); }
.st-content-head { flex: none; height: 49px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 16px; border-bottom: 1px solid var(--border-muted); }
.st-crumbs { color: var(--text-default); font-size: 16px; font-weight: 500; line-height: 20px; }
.st-close { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--icon-subtle); }
.st-close:hover { background: var(--bg-mod-subtle); color: var(--text-strong); }
.st-body { flex: 1; min-height: 0; overflow-y: scroll; }
.st-panel { max-width: 728px; margin: 64px auto; padding: 0 16px; }
.st-panel.with-preview { margin-top: 0; }
.st-cat-head { display: flex; flex-direction: column; gap: 4px; padding-bottom: 20px; }
.st-cat-head h2 { color: var(--text-strong); font-size: 24px; font-weight: 400; line-height: 30px; }
.st-cat-desc { color: var(--text-subtle); font-size: 14px; line-height: 18px; }
.st-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 1px; }
.st-divider { height: 1px; margin: 40px 0; background: var(--border-subtle); }
.st-desc { color: var(--text-subtle); font-size: 14px; line-height: 18px; }
.st-link { color: var(--text-link); }
.st-subhead { color: var(--text-strong); font-size: 16px; font-weight: 600; line-height: 20px; }
.st-subhead.muted { margin-bottom: 4px; color: var(--text-muted); }

/* rows with something on the right (baseControlItem) */
.st-item { display: flex; gap: 12px; margin: 0 -12px; padding: 12px; border-radius: 16px; }
.st-item.clickable { cursor: pointer; }
.st-item.clickable:hover { background: var(--interactive-bg-hover); }
.st-item-lead { flex: none; display: flex; align-items: center; }
.st-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.st-item-title { color: var(--text-strong); font-size: 16px; font-weight: 500; line-height: 20px; }
.st-item-trail { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 16px; color: var(--text-default); }
.st-trail-text, .st-value { color: var(--text-default); font-size: 16px; font-weight: 500; line-height: 20px; }
.st-chev { display: flex; align-items: center; gap: 12px; }
.st-pair { display: flex; align-items: center; gap: 4px; }
.st-text-btn { color: #798df9; font-size: 16px; font-weight: 500; line-height: 20px; }
.st-text-btn:hover { text-decoration: underline; }
.st-icon-box { width: 48px; height: 48px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--bg-mod-subtle); color: var(--text-default); }
.st-icon-box.soft { background: rgba(151, 151, 159, 0.08); }
.mbtn.danger-text { color: #f87e7a; }

/* form rows (baseSettingWrapper) */
.st-setting { padding: 8px 0; }
.st-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 24px; align-items: start; }
.st-inline.disabled { opacity: 0.5; }
.st-label-col { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.st-label { color: var(--text-strong); font-size: 16px; font-weight: 500; line-height: 20px; }
.st-inline .st-desc { max-width: 572px; }
.st-inline.nodesc { align-items: center; }
.st-inline.nodesc + .st-inline.nodesc { margin-top: 8px; }
.st-group { min-width: 0; display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; border: 0; }
.st-group > .st-setting { padding: 8px 0; }
.st-group > .st-inline.nodesc + .st-inline.nodesc { margin-top: 0; }
.st-legend { float: left; width: 100%; padding: 8px 0 0; }
.st-legend + * { clear: both; }
.st-select-chevron { margin: -2px; }
.st-field-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.st-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.st-inline-control { display: flex; justify-content: flex-end; }
.st-switch { position: relative; flex: none; width: 48px; height: 24px; padding: 0; border: 1px solid var(--border-normal); border-radius: 16px; background: rgba(0, 0, 0, 0.12); }
.st-thumb { position: absolute; left: -1px; top: -1px; width: 24px; height: 24px; fill: #fff; transition: transform 0.15s ease-out; }
.st-switch.on { border-color: var(--brand); background: var(--brand); }
.st-switch.on .st-thumb { transform: translateX(24px); }
.st-switch:disabled { cursor: not-allowed; }
.st-radios { display: flex; flex-direction: column; gap: 16px; padding: 8px 0 4px; }
.st-radio { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-height: 20px; padding-left: 32px; border-radius: var(--radius-sm); text-align: left; }
.st-radio-dot { position: absolute; left: 0; top: 0; width: 20px; height: 20px; border: 1px solid rgba(151, 151, 159, 0.6); border-radius: 50%; background: rgba(0, 0, 0, 0.1); }
.st-radio-label { color: var(--text-default); font-size: 16px; line-height: 20px; }
.st-radio-desc { margin-top: 4px; color: var(--text-subtle); font-size: 14px; line-height: 18px; }
.st-select { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; height: 40px; padding: 8px 8px 8px 12px; border: 1px solid var(--border-normal); border-radius: var(--radius-sm); background: rgba(0, 0, 0, 0.12); color: var(--text-default); cursor: pointer; }
.st-select[aria-expanded="true"] { border-color: var(--brand); }
.st-select-value { min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 500; line-height: 20px; }
.st-select-value > span:last-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-select-chevron, .st-dev-icon { display: flex; color: var(--text-default); }
.st-dev-icon { margin-right: 4px; }
.st-sel-img { width: 24px; height: 24px; padding: 3px; border-radius: 6px; background: var(--brand); }
.st-sel-abbr { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: var(--bg-mod-strong); font-size: 9px; font-weight: 600; }
.st-flag { display: flex; }
.st-flag-img { width: 28px; height: 28px; }
.st-select-pop { position: fixed; z-index: 90; max-height: 300px; padding: 4px; overflow-y: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-surface-higher); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24); }
.st-select-opt { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 4px; color: var(--text-default); font-size: 16px; font-weight: 500; line-height: 20px; cursor: pointer; }
.st-select-opt:hover { background: var(--interactive-bg-hover); color: var(--text-strong); }
.st-select-opt.selected { color: var(--text-strong); }
.st-opt-check { display: flex; margin-left: auto; color: var(--brand); }
.st-slider-wrap { position: relative; }
.st-slider-wrap.ticked { padding-top: 22px; }
.st-ticks { position: absolute; left: 0; right: 0; top: 0; height: 16px; }
.st-tick { position: absolute; top: 0; transform: translateX(-50%); color: var(--text-subtle); font-size: 12px; font-weight: 500; line-height: 16px; white-space: nowrap; }
.st-tick.on { color: #5eb479; }
.st-tick-marks { position: absolute; left: 0; right: 0; top: 22px; height: 24px; pointer-events: none; }
.st-tick-marks i { position: absolute; top: 4px; width: 2px; height: 16px; margin-left: -1px; border-radius: 1px; background: #4e4f58; }
.st-notice-wrap { margin-bottom: 8px; }
.st-notice { display: flex; align-items: flex-start; padding: 8px; border: 1px solid; border-radius: var(--radius-sm); }
.st-notice.info { border-color: #66a5f3; background: rgba(0, 116, 227, 0.078); }
.st-notice.warning { border-color: #ea9800; background: rgba(248, 163, 0, 0.078); }
.st-notice-icon { flex: none; display: flex; color: #66a5f3; }
.st-notice.warning .st-notice-icon { color: #ea9800; }
.st-notice-text { flex: 1; min-width: 0; margin-left: 8px; color: var(--text-default); font-size: 14px; font-weight: 500; line-height: 18px; }
.st-related { padding-top: 8px; }
.st-collapse-btn { width: 48px; height: 48px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--bg-mod-subtle); color: var(--text-default); }
.st-collapse-btn:hover { background: var(--bg-mod-normal); }
.st-collapse-btn .ic { transition: transform 0.15s ease-out; }
.st-collapse.open .st-collapse-btn .ic { transform: rotate(180deg); }
.st-collapse-body { padding-top: 8px; }
.st-sound-list > .st-setting + .st-setting { border-top: 1px solid var(--border-subtle); }
.st-sound-list > .st-setting { padding: 12px 0; }
.st-preview-sound { margin-top: -2px; font-size: 14px; line-height: 18px; }
.st-preview-sound:hover { text-decoration: underline; }
.st-mic-test { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 16px; margin: 4px 0; }
.st-mic-btn { min-width: 117px; }
.st-mic-caption { grid-column: 2; min-height: 32px; margin-left: 2px; color: var(--text-subtle); font-size: 12px; line-height: 16px; }
.st-mic-test .st-mic-btn { align-self: start; }
.st-meter { position: relative; height: 28px; overflow: hidden; background: #46474f; -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 4px, transparent 4px 8px); mask-image: repeating-linear-gradient(90deg, #000 0 4px, transparent 4px 8px); }
.st-meter-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--status-online); }
.st-help { margin-top: 4px; }
.st-camera { position: relative; height: 220px; display: grid; place-items: center; overflow: hidden; margin: 8px 0; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-base-lowest); }
.st-camera-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.st-camera .mbtn { position: relative; }
.st-inline-emoji { width: 18px; height: 18px; vertical-align: -4px; }
/* keybinds */
.st-kb { display: flex; flex-direction: column; gap: 48px; padding: 8px 0; }
.st-kb-fieldset { min-width: 0; display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; border: 0; }
.st-kb-legend { float: left; width: 100%; margin-bottom: -4px; padding: 0; color: var(--text-strong); font-size: 20px; font-weight: 500; line-height: 24px; }
.st-kb-desc { margin-top: -8px; color: var(--text-default); font-size: 14px; line-height: 18px; }
.st-kb-group { display: flex; flex-direction: column; gap: 16px; padding: 16px 0; border: 1px solid var(--border-muted); border-radius: var(--radius-md); background: var(--bg-surface-higher); }
.st-kb-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px; color: var(--text-default); font-size: 16px; line-height: 20px; }
.st-kb-divider { height: 1px; background: var(--border-subtle); }
.st-kb-combos { display: grid; justify-items: end; gap: 4px; }
.st-combo { display: flex; }
.st-key { margin-right: 3px; padding: 3px 6px 4px; border: 1px solid var(--border-subtle); border-radius: 4px; background: rgba(151, 151, 159, 0.08); box-shadow: inset 0 -4px 0 rgba(151, 151, 159, 0.08); color: var(--text-strong); font: 600 12px/16px var(--font); text-transform: uppercase; }
.st-key:last-child { margin-right: 0; }
/* appearance */
.st-subhead.tight { margin: 0; }
.st-themes { display: flex; gap: 8px; padding-top: 24px; }
.st-theme { position: relative; width: 48px; height: 48px; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px #abacb2; }
.st-theme.light { background: #fff; }
.st-theme.ash { background: #323339; }
.st-theme.dark { background: #1d1d21; }
.st-theme.onyx { background: #000; }
.st-theme.sync { display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--border-normal); color: var(--text-default); }
.st-theme.selected::after { content: ""; position: absolute; inset: -2px; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 4px var(--brand); }
.st-theme-check { position: absolute; z-index: 1; right: -8px; top: -8px; display: flex; border-radius: 50%; background: #fff; color: var(--brand); }
/* accessibility preview */
.st-preview-sticky { position: sticky; top: 0; z-index: 3; margin: 0 -16px 48px; padding: 64px 16px 0; background: var(--bg-base-low); }
.st-preview-title { margin-bottom: 8px; color: var(--text-muted); font-size: 16px; font-weight: 500; line-height: 20px; }
.st-preview { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 24px 24px 24px 8px; border: 1px solid var(--border-normal); border-radius: var(--radius-sm); background: var(--bg-base-low); }
.st-prev-msgs { display: flex; flex-direction: column; gap: 16px; }
.st-prev-msg { position: relative; padding: 2px 24px 2px 72px; }
.st-prev-msg .msg-name { color: #dd80f4; }
.st-prev-msg .reactions { padding: 4px 0 0; }
.st-prev-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.st-prev-avatars { display: flex; flex-direction: column; gap: 6px; }
/* activity privacy + connected apps */
.st-search { margin: 8px 0; }
.st-list-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.st-sort { display: flex; align-items: center; gap: 4px; color: var(--text-subtle); font-size: 14px; font-weight: 500; line-height: 18px; }
.st-list-head .st-text-btn { font-size: 14px; line-height: 18px; }
.st-server-row { display: flex; align-items: center; gap: 16px; padding: 8px 0; }
.st-server-row[hidden], .st-app-card[hidden] { display: none; }
.st-server-row .st-label-col { flex: 1; }
.st-server-icon { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: var(--bg-mod-subtle); color: var(--text-default); font-size: 14px; font-weight: 500; }
.st-conn-grid { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 0; }
.st-conn { width: 48px; height: 48px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--bg-mod-subtle); color: var(--text-default); }
.st-conn:hover { background: var(--bg-mod-normal); color: var(--text-strong); }
.st-empty { padding: 64px 0; text-align: center; }
.st-empty h4 { color: var(--text-muted); font-size: 20px; font-weight: 600; line-height: 24px; text-transform: uppercase; }
.st-empty p { margin-top: 8px; color: var(--text-muted); font-size: 16px; line-height: 20px; }
.st-app-card { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius-sm); background: var(--bg-mod-normal); }
.st-app-card .st-label-col { flex: 1; }
.st-app-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); }
.st-app-more { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--bg-base-lower); color: var(--icon-subtle); }
.st-textarea { height: auto; padding: 8px 12px; }
.st-textarea textarea { width: 100%; border: 0; background: transparent; color: var(--text-default); font: 16px/20px var(--font); resize: none; outline: none; }

/* ---------- Settings > My Account dialogs (live): fields with their own error line ---------- */
.acct-modal .md-body { padding-bottom: 8px; }
.acct-item + .acct-item { margin-top: 16px; }
.acct-err { margin-top: 6px; color: #f87e7a; font-size: 14px; line-height: 18px; }
.acct-err:empty { display: none; }
.mbtn.busy { opacity: 0.6; pointer-events: none; }
