/* Hush — themes: Dark (default) and Light. Special themes can be added later
   as more [data-theme="…"] blocks that override these variables. */

:root {
  --bg-rail: #1e1f22;
  --bg-side: #2b2d31;
  --bg-chat: #313338;
  --bg-panel: #232428;
  --bg-deep: #1e1f22;
  --bg-input: #383a40;
  --bg-float: #111214;
  --bg-modal: #313338;
  --bg-modal-foot: #2b2d31;
  --bg-hover: rgba(78, 80, 88, 0.3);
  --bg-active: rgba(78, 80, 88, 0.6);
  --msg-hover: rgba(2, 2, 2, 0.06);
  --border: rgba(255, 255, 255, 0.06);
  --sep: rgba(255, 255, 255, 0.07);
  --chip: rgba(255, 255, 255, 0.06);
  --chip-hover: rgba(255, 255, 255, 0.1);
  --chip-border: rgba(255, 255, 255, 0.12);
  --rail-item: #313338;
  --intro-icon: #41434a;
  --popout: #232428;
  --popout-card: #111214;
  --popout-card-hover: #1a1b1e;
  --btn-2: #4e5058;
  --btn-2-hover: #6d6f78;
  --toggle-off: #72767d;
  --scroll: #1a1b1e;
  --scroll-hover: #121315;
  --shadow: rgba(0, 0, 0, 0.45);
  --text: #dbdee1;
  --strong: #f2f3f5;
  --muted: #949ba4;
  --faint: #80848e;
  --icon: #b5bac1;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --accent-soft: rgba(88, 101, 242, 0.16);
  --accent-text: #a5acff;
  --ok-text: #6fd39a;
  --link: #00a8fc;
  --green: #23a55a;
  --red: #f23f43;
  --yellow: #f0b232;
  --radius: 8px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg-rail: #e3e5e8;
  --bg-side: #f2f3f5;
  --bg-chat: #ffffff;
  --bg-panel: #ebedef;
  --bg-deep: #e3e5e8;
  --bg-input: #ebedef;
  --bg-float: #ffffff;
  --bg-modal: #ffffff;
  --bg-modal-foot: #f2f3f5;
  --bg-hover: rgba(116, 124, 138, 0.14);
  --bg-active: rgba(116, 124, 138, 0.24);
  --msg-hover: rgba(6, 6, 7, 0.03);
  --border: rgba(6, 6, 7, 0.08);
  --sep: rgba(6, 6, 7, 0.1);
  --chip: rgba(6, 6, 7, 0.05);
  --chip-hover: rgba(6, 6, 7, 0.08);
  --chip-border: rgba(6, 6, 7, 0.14);
  --rail-item: #ffffff;
  --intro-icon: #e3e5e8;
  --popout: #ffffff;
  --popout-card: #f2f3f5;
  --popout-card-hover: #e3e5e8;
  --btn-2: #6d6f78;
  --btn-2-hover: #4e5058;
  --toggle-off: #80848e;
  --scroll: #c4c9ce;
  --scroll-hover: #a3a9ae;
  --shadow: rgba(0, 0, 0, 0.16);
  --text: #313338;
  --strong: #060607;
  --muted: #5c5e66;
  --faint: #6d6f78;
  --icon: #4e5058;
  --accent-soft: rgba(88, 101, 242, 0.12);
  --accent-text: #4752c4;
  --ok-text: #1a7f45;
  --link: #006ce7;
  color-scheme: light;
}

/* Theme picker cards (Settings → Appearance) */
.theme-picks { display: flex; gap: 12px; }
.theme-pick {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font: 600 14px var(--font);
  cursor: pointer;
}
.theme-pick:hover { background: var(--bg-hover); }
.theme-pick.on { border-color: var(--accent); }
.theme-swatch { width: 100%; height: 64px; border-radius: 8px; display: flex; overflow: hidden; box-shadow: 0 0 0 1px var(--border); }
.theme-swatch i { display: block; }
.theme-swatch i:nth-child(1) { width: 18%; }
.theme-swatch i:nth-child(2) { width: 27%; }
.theme-swatch i:nth-child(3) { flex: 1; }
.theme-swatch.dark i:nth-child(1) { background: #1e1f22; }
.theme-swatch.dark i:nth-child(2) { background: #2b2d31; }
.theme-swatch.dark i:nth-child(3) { background: #313338; }
.theme-swatch.light i:nth-child(1) { background: #e3e5e8; }
.theme-swatch.light i:nth-child(2) { background: #f2f3f5; }
.theme-swatch.light i:nth-child(3) { background: #ffffff; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-rail);
  color: var(--text);
  font: 14px/1.375 var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
button:focus-visible, [role="button"]:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.hidden { display: none !important; }
.ico { flex-shrink: 0; display: block; }

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

/* ------------------------------------------------------------ desktop title bar */

.titlebar {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-rail);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  -webkit-app-region: drag;
  user-select: none;
}
.tb-logo { color: var(--accent); display: flex; }
.desktop .app { height: calc(100vh - 30px); }
.has-banner .app { height: calc(100vh - 36px); }
.desktop .has-banner .app { height: calc(100vh - 66px); }
.update-bar {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 40px;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}
.ub-btn {
  height: 24px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  background: none;
  color: #fff;
  font: 600 13px var(--font);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
}
.ub-btn:hover { background: #fff; color: var(--green); text-decoration: none; }
.ub-btn:disabled { opacity: 0.7; cursor: default; }
.ub-close { position: absolute; right: 10px; border: 0; background: none; color: #fff; display: flex; cursor: pointer; opacity: 0.85; }
.ub-close:hover { opacity: 1; }

/* ------------------------------------------------------------ layout */

.app {
  display: grid;
  grid-template-columns: 72px 240px minmax(0, 1fr) 240px;
  height: 100vh;
  height: 100dvh;
}
.app.hide-members { grid-template-columns: 72px 240px minmax(0, 1fr); }
.app.hide-members .members { display: none; }

/* ------------------------------------------------------------ server rail */

.rail {
  background: var(--bg-rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-row { position: relative; width: 72px; display: flex; justify-content: center; flex-shrink: 0; }
.rail-pill {
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 0;
  border-radius: 0 4px 4px 0;
  background: var(--strong);
  transform: translateY(-50%);
  transition: height 0.15s ease;
}
.rail-pill.unread { height: 8px; }
.rail-row:hover .rail-pill:not(.active) { height: 20px; }
.rail-pill.active { height: 40px; }
.rail-tip { display: none; }

.rail-item {
  position: relative;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--rail-item);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: border-radius 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.rail-item:hover, .rail-item.active { border-radius: 16px; background: var(--c, var(--accent)); color: #fff; }
.rail-item.home { color: var(--text); }
.rail-item.home:hover, .rail-item.home.active { background: var(--accent); color: #fff; }
.rail-item.home .logo-hole { fill: var(--rail-item); }
.rail-item.home:hover .logo-hole, .rail-item.home.active .logo-hole { fill: var(--accent); }
.rail-item.action { color: var(--green); }
.rail-item.action:hover { background: var(--green); color: #fff; }
.rail-initials { pointer-events: none; }
.rail-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  border: 3px solid var(--bg-rail);
}
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--sep); flex-shrink: 0; }

.tooltip {
  position: fixed;
  z-index: 300;
  background: var(--bg-float);
  color: var(--strong);
  font-size: 15px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 6px;
  box-shadow: 0 8px 16px var(--shadow);
  pointer-events: none;
  white-space: nowrap;
  transform: translateY(-50%);
  animation: pop 0.1s ease;
}
.tooltip::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 50%;
  border: 5px solid transparent;
  border-left: 0;
  border-right-color: var(--bg-float);
  transform: translateY(-50%);
}

/* ------------------------------------------------------------ sidebar */

.sidebar {
  background: var(--bg-side);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-top-left-radius: 8px;
}
.side-top {
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
}
.side-top.flush { padding: 0; }
.side-search {
  width: 100%;
  height: 28px;
  border: 0;
  border-radius: 6px;
  padding: 0 8px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
}
.side-search::placeholder { color: var(--muted); text-align: center; }
.side-search:focus::placeholder { text-align: left; }
.server-header {
  width: 100%;
  height: 100%;
  border: 0;
  background: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: var(--strong);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-top-left-radius: 8px;
}
.server-header:hover { background: var(--bg-hover); }
.server-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-scroll { flex: 1; overflow-y: auto; padding: 8px 8px 16px; min-height: 0; }
.side-empty { color: var(--faint); font-size: 13px; padding: 12px 8px; }

.home-nav { padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.home-link {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  margin: 2px 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.home-link:hover { background: var(--bg-hover); color: var(--text); }

.cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 4px 4px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  user-select: none;
}
.cat:hover { color: var(--text); }
.cat-add { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; display: flex; border-radius: 4px; }
.cat-add:hover { color: var(--strong); }

.dm-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 8px;
  margin: 1px 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}
.dm-item:hover { background: var(--bg-hover); color: var(--text); }
.dm-item.active { background: var(--bg-active); color: var(--strong); }
.dm-item.unread .dm-name { color: var(--strong); font-weight: 600; }
.dm-text { flex: 1; min-width: 0; }
.dm-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.in-call { color: var(--green); display: inline-flex; align-items: center; gap: 3px; }
.dm-close { opacity: 0; border: 0; background: none; color: var(--muted); padding: 2px; border-radius: 4px; cursor: pointer; display: flex; }
.dm-item:hover .dm-close { opacity: 1; }
.dm-close:hover { color: var(--strong); }

.ch-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 8px;
  margin: 1px 0;
  border-radius: 6px;
  color: var(--faint);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.ch-ico { color: var(--faint); }
.ch-item:hover { background: var(--bg-hover); color: var(--text); }
.ch-item.active { background: var(--bg-active); color: var(--strong); }
.ch-item.unread { color: var(--strong); font-weight: 600; }
.ch-item.connected { color: var(--strong); }
.ch-item.connected .ch-ico { color: var(--green); }
.ch-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-unread-pill { position: absolute; left: -8px; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--strong); }
.ch-tools { display: none; gap: 2px; }
.ch-item:hover .ch-tools, .ch-item.active .ch-tools { display: flex; }
.ch-item:hover .ch-count { display: none; }
.ch-count { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--chip); padding: 1px 6px; border-radius: 8px; }

.voice-users { padding: 0 0 4px 28px; }
.voice-user {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
}
.voice-user:hover { background: var(--bg-hover); color: var(--text); }
.voice-user.speaking .vu-name { color: var(--strong); }
.vu-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vu-icons { color: var(--muted); display: flex; gap: 2px; }

/* voice connected + user panels */

.voice-panel { background: var(--bg-panel); border-bottom: 1px solid var(--border); padding: 8px; flex-shrink: 0; }
.vp-row { display: flex; align-items: center; gap: 4px; }
.vp-info { flex: 1; min-width: 0; padding-left: 4px; }
.vp-status { display: flex; align-items: center; gap: 6px; color: var(--green); font-weight: 600; font-size: 14px; }
.vp-status.connecting { color: var(--yellow); }
.vp-where {
  display: block;
  max-width: 100%;
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vp-where:hover { color: var(--text); text-decoration: underline; }
.icon-btn.vp-leave:hover { color: var(--red); }

.user-panel {
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  background: var(--bg-panel);
}
.up-me {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 2px;
  border: 0;
  border-radius: 6px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.up-me:hover { background: var(--bg-hover); }
.up-text { min-width: 0; }
.up-name { color: var(--strong); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-status { color: var(--muted); font-size: 12px; white-space: nowrap; }

.icon-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--icon);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--strong); }
.icon-btn.danger { color: var(--red); }
.icon-btn.active { color: var(--strong); }
.icon-btn.tiny { width: 20px; height: 20px; border-radius: 4px; color: var(--muted); }
.icon-btn.tiny:hover { background: none; color: var(--strong); }
.icon-btn.danger-hover:hover { color: var(--red); }
.mobile-only { display: none; }

/* avatars */

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  transition: box-shadow 0.1s ease;
}
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.avatar.sm, .avatar.md { width: 32px; height: 32px; }
.avatar.xl { width: 80px; height: 80px; font-size: 28px; }
.avatar.xxl { width: 80px; height: 80px; font-size: 28px; }
.avatar.ring.speaking { box-shadow: 0 0 0 2px var(--bg-side), 0 0 0 4px var(--green); }
.avatar.xl.ring.speaking { box-shadow: 0 0 0 3px #000, 0 0 0 6px var(--green); }
.avatar-wrap { position: relative; flex-shrink: 0; }
.status-dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 4px solid var(--bg-panel);
  background: var(--green);
}
.members .status-dot { border-color: var(--bg-side); }
.status-dot.idle { background: var(--yellow); }

/* ------------------------------------------------------------ main / chat */

.main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-chat);
}
.chat-header {
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.hd-dyn { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 8px; }
.hd-search { flex-shrink: 0; display: flex; margin-left: 4px; }
.hd-search input {
  width: 150px;
  height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: var(--bg-deep);
  color: var(--text);
  font: 13px var(--font);
  outline: none;
  transition: width 0.2s ease;
}
.hd-search input:focus, .hd-search input:not(:placeholder-shown) { width: 230px; }
.hd-search input::placeholder { color: var(--muted); }
.hd-hash { color: var(--faint); }
.hd-title {
  color: var(--strong);
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 0;
  background: none;
  padding: 2px 4px;
  border-radius: 4px;
}
.hd-title.editable { cursor: text; }
.hd-title.editable:hover { background: var(--bg-input); }
.hd-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
.e2e { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.e2e .ico { color: var(--green); }
.hd-spacer { flex: 1; }

.chat-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
.messages > * { flex-shrink: 0; }
.messages > :first-child { margin-top: auto; }
.msg-spacer { height: 24px; }

.msg { position: relative; padding: 2px 56px 2px 72px; min-height: 22px; }
.msg.first { margin-top: 17px; }
.msg:hover { background: var(--msg-hover); }
.msg-avatar { position: absolute; left: 16px; top: 4px; width: 40px; height: 40px; font-size: 15px; cursor: default; }
.msg-head { display: flex; align-items: baseline; gap: 8px; line-height: 22px; min-width: 0; }
.msg-author { color: var(--strong); font-size: 15px; font-weight: 600; }
.msg-time { color: var(--faint); font-size: 12px; font-weight: 500; white-space: nowrap; }
.msg-text { color: var(--text); font-size: 15px; line-height: 1.375; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.msg-gutter-time {
  position: absolute;
  left: 0;
  width: 72px;
  top: 4px;
  text-align: center;
  font-size: 11px;
  color: var(--faint);
  opacity: 0;
}
.msg:hover .msg-gutter-time { opacity: 1; }
.msg-actions {
  position: absolute;
  right: 16px;
  top: -14px;
  display: none;
  background: var(--bg-side);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.msg:hover .msg-actions { display: flex; }

.day-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 16px 8px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
}
.day-divider::before, .day-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.attach-img-wrap {
  display: block;
  margin-top: 6px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  max-width: min(400px, 100%);
  background: var(--chip);
  cursor: zoom-in;
}
.attach-img { display: block; max-width: 100%; height: auto; max-height: 350px; min-height: 40px; min-width: 40px; }
.attach-error { margin-top: 6px; color: var(--muted); font-size: 13px; font-style: italic; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; background: var(--chip); }
.attach-file {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  max-width: 432px;
  padding: 12px;
  background: var(--bg-side);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.af-ico { color: var(--accent); }
.af-info { flex: 1; min-width: 0; }
.af-name {
  display: block;
  max-width: 100%;
  border: 0;
  background: none;
  padding: 0;
  color: var(--link);
  font-size: 15px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.af-name:hover { text-decoration: underline; }
.af-size { color: var(--faint); font-size: 12px; }

.intro { padding: 16px 16px 4px; }
.intro-icon { width: 68px; height: 68px; border-radius: 50%; background: var(--intro-icon); color: var(--strong); display: grid; place-items: center; }
.intro h1 { color: var(--strong); font-size: 30px; font-weight: 700; margin: 8px 0 4px; line-height: 1.2; }
.intro p { color: var(--muted); font-size: 15px; margin: 0; }
.intro-e2e {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(35, 165, 90, 0.1);
  border: 1px solid rgba(35, 165, 90, 0.25);
  color: var(--ok-text);
  font-size: 13px;
  max-width: 640px;
}
.intro-e2e .ico { color: var(--green); }

.msg-status { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 32px 16px; text-align: center; }
.msg-status.small { padding: 12px; font-size: 13px; margin-bottom: auto; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--bg-active); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }

.composer-wrap { padding: 0 16px; flex-shrink: 0; }
.composer {
  display: flex;
  align-items: flex-start;
  background: var(--bg-input);
  border-radius: 8px;
  padding-right: 16px;
  min-height: 44px;
}
.attach-btn {
  width: 24px;
  height: 24px;
  margin: 10px 16px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--icon);
  color: var(--bg-input);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.attach-btn:hover { background: var(--strong); }
.attach-btn .ico { stroke-width: 3; }
#input {
  flex: 1;
  min-width: 0;
  max-height: 300px;
  padding: 11px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  font: 15px/22px var(--font);
}
#input::placeholder { color: var(--faint); }
.composer-tools { display: flex; align-items: center; height: 44px; gap: 4px; margin-left: 8px; }
.composer-tool { border: 0; background: none; color: var(--icon); padding: 4px; border-radius: 4px; cursor: pointer; display: grid; place-items: center; transition: transform 0.1s ease, color 0.1s ease; }
.composer-tool:hover { color: var(--strong); transform: scale(1.12); }

.msg-text.jumbo { font-size: 44px; line-height: 1.2; }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--chip);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.react-chip:hover { border-color: var(--chip-border); background: var(--chip-hover); }
.react-chip.mine { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.react-chip .re { font-size: 16px; line-height: 1; }
.react-chip .rc { font-weight: 600; font-size: 13px; }
.react-chip.add { opacity: 0; padding: 0 6px; }
.msg:hover .react-chip.add { opacity: 1; }

.emoji-pop {
  position: fixed;
  z-index: 160;
  width: 352px;
  padding: 10px;
  border-radius: 10px;
  background: var(--bg-float);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px var(--shadow);
  animation: pop 0.1s ease;
}
.emoji-head { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; padding: 2px 4px 8px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-btn { height: 40px; border: 0; border-radius: 6px; background: none; font-size: 24px; cursor: pointer; line-height: 1; }
.emoji-btn:hover { background: var(--bg-hover); }

.search-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-side);
  border: 1px solid var(--border);
  color: var(--strong);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: auto;
}
.search-banner .ico { color: var(--green); }
.search-banner small { color: var(--muted); font-weight: 400; flex: 1; }
.btn.small { height: 28px; padding: 0 8px; font-size: 13px; }

.typing { height: 24px; display: flex; align-items: center; gap: 6px; padding-left: 4px; color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; }
.typing strong { font-weight: 700; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }

.drop-hint { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0, 0, 0, 0.6); pointer-events: none; }
.drop-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 40px; border-radius: 12px; background: var(--accent); color: #fff; box-shadow: 0 0 0 8px rgba(91, 102, 245, 0.3); }
.drop-card strong { font-size: 20px; }

.empty-main { margin: auto; padding: 32px 16px; max-width: 480px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.empty-logo { color: var(--accent); }
.empty-logo .logo-hole, .welcome-logo .logo-hole { fill: var(--bg-chat); }
.empty-main h1 { color: var(--strong); font-size: 24px; margin: 16px 0 8px; }
.empty-main p { color: var(--muted); font-size: 15px; margin: 0 0 24px; }
.empty-actions { display: flex; flex-direction: column; gap: 8px; width: 260px; }

/* ------------------------------------------------------------ group call */

.call {
  flex-shrink: 0;
  background: #000;
  padding: 24px 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--border);
}
.call-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; max-height: 260px; overflow-y: auto; padding: 6px; }
.call-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 96px; }
.call-name { color: var(--text); font-size: 13px; max-width: 96px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-muted { position: absolute; top: 56px; right: 4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; border: 3px solid #000; }
.call-controls { display: flex; gap: 12px; }
.call-btn { width: 52px; height: 52px; border: 0; border-radius: 50%; background: #2a2b38; color: #fff; display: grid; place-items: center; cursor: pointer; }
.call-btn:hover { background: #393a4a; }
.call-btn.off { background: #fff; color: #111; }
.call-btn.hangup { background: var(--red); }
.call-btn.hangup:hover { background: #d8353a; }
.call-btn.join { width: auto; padding: 0 22px; border-radius: 26px; background: var(--green); display: flex; gap: 8px; font-weight: 600; font-size: 15px; }
.call-btn.join:hover { background: #1f9150; }
.call-e2e { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.call-e2e .ico { color: var(--green); }

/* ------------------------------------------------------------ members */

.members { background: var(--bg-side); overflow-y: auto; padding: 0 8px 20px; min-height: 0; }
.mem-cat { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; padding: 24px 8px 4px; }
.mem { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 8px; margin: 1px 0; border-radius: 6px; cursor: default; }
.mem:hover { background: var(--bg-hover); }
.mem.off { opacity: 0.4; }
.mem.off:hover { opacity: 1; }
.mem-text { min-width: 0; flex: 1; }
.mem-name { color: var(--text); font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; }
.mem-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.you-tag { margin-left: 6px; padding: 0 4px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; }

/* ------------------------------------------------------------ buttons, inputs */

.btn {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary.ok { background: var(--green); }
.btn.secondary { background: var(--btn-2); color: #fff; }
.btn.secondary:hover { background: var(--btn-2-hover); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { background: #d8353a; }
.btn.link { background: none; color: var(--strong); }
.btn.link:hover { text-decoration: underline; }
.btn.danger-link { background: none; color: var(--red); margin-right: auto; padding-left: 0; }
.btn.danger-link:hover { text-decoration: underline; }
.btn.wide { width: 100%; }

.input {
  width: 100%;
  height: 40px;
  padding: 10px;
  border: 0;
  border-radius: 6px;
  background: var(--bg-deep);
  color: var(--text);
  font: 15px var(--font);
  outline: none;
}
.input:focus { box-shadow: 0 0 0 2px rgba(91, 102, 245, 0.5); }
select.input { padding: 0 10px; cursor: pointer; }
.field-label { display: block; margin: 18px 0 8px; color: var(--icon); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.field-label:first-child { margin-top: 0; }
.req { color: var(--red); margin-left: 3px; }
.field-hint { margin-top: 8px; color: var(--muted); font-size: 12px; }
.field-hint code { background: var(--bg-deep); padding: 1px 4px; border-radius: 4px; font-size: 11px; word-break: break-all; }
.field-error { color: var(--red); font-size: 12px; margin-top: 6px; min-height: 0; }
.field-error:empty { display: none; }

/* ------------------------------------------------------------ modals */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fade 0.12s ease;
}
.overlay.out { opacity: 0; transition: opacity 0.12s ease; }
.modal {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--bg-modal);
  border-radius: 10px;
  padding: 24px 16px 0;
  box-shadow: 0 16px 48px var(--shadow);
  animation: pop 0.15s ease;
}
.modal-x { position: absolute; top: 12px; right: 12px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 4px; display: flex; }
.modal-x:hover { color: var(--strong); }
.modal-title { color: var(--strong); text-align: center; font-size: 22px; font-weight: 700; margin: 0 24px 8px; }
.modal-sub { color: var(--muted); text-align: center; font-size: 15px; margin: 0 8px 4px; }
.modal-body { padding: 16px 0; }
.modal-text { color: var(--text); font-size: 15px; margin: 0; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin: 0 -16px;
  padding: 16px;
  background: var(--bg-modal-foot);
  border-radius: 0 0 10px 10px;
}

.add-modal .modal-body { padding-bottom: 0; }
.add-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 10px 16px 10px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  color: var(--strong);
  text-align: left;
  cursor: pointer;
}
.add-option:hover { background: var(--bg-hover); }
.ao-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.ao-text { flex: 1; display: flex; flex-direction: column; }
.ao-text strong { font-size: 15px; }
.ao-text small { color: var(--muted); font-size: 12px; }
.ao-chev { transform: rotate(-90deg); color: var(--muted); }
.add-footer { margin: 16px -16px 0; padding: 16px; background: var(--bg-modal-foot); text-align: center; border-radius: 0 0 10px 10px; }
.add-footer h3 { color: var(--strong); font-size: 18px; font-weight: 600; margin: 0 0 10px; }

.copy-row { display: flex; align-items: center; gap: 4px; padding: 4px; background: var(--bg-deep); border-radius: 6px; }
.copy-row .input { background: transparent; height: 32px; padding: 0 6px; font-size: 14px; }
.copy-row .input:focus { box-shadow: none; }
.copy-btn { height: 32px; min-width: 75px; }
.invite-warn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}
.invite-warn .ico { margin-top: 1px; color: var(--accent-text); }
.invite-warn.yellow { background: rgba(240, 178, 50, 0.12); }
.invite-warn.yellow .ico { color: var(--yellow); }

.ch-types { display: flex; flex-direction: column; gap: 8px; }
.ch-type {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: var(--bg-deep);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}
.ch-type > span:not(.radio) { flex: 1; display: flex; flex-direction: column; }
.ch-type strong { color: var(--text); font-size: 15px; }
.ch-type small { font-size: 12px; }
.ch-type:hover, .ch-type.on { background: var(--bg-active); }
.radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted); flex-shrink: 0; }
.ch-type.on .radio { border-color: var(--strong); box-shadow: inset 0 0 0 3px var(--bg-active), inset 0 0 0 10px var(--strong); }

.lightbox { background: transparent; box-shadow: none; padding: 0; width: auto; max-width: 92vw; overflow: visible; }
.lightbox .modal-x { display: none; }
.lightbox .modal-body { padding: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.lightbox img { display: block; max-width: 92vw; max-height: 82vh; border-radius: 6px; }
.lightbox-open { border: 0; background: none; color: var(--muted); padding: 0; font-size: 14px; cursor: pointer; }
.lightbox-open:hover { color: var(--strong); text-decoration: underline; }

.profile-card { border-radius: 8px; overflow: hidden; background: var(--bg-deep); margin-bottom: 4px; }
.profile-banner { height: 64px; }
.profile-row { display: flex; align-items: flex-end; gap: 12px; padding: 0 16px 14px; margin-top: -40px; }
.profile-row .avatar { box-shadow: 0 0 0 6px var(--bg-deep); }
.profile-name { color: var(--strong); font-size: 20px; font-weight: 700; padding-bottom: 6px; }
.settings-h { color: var(--icon); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; margin: 24px 0 12px; padding-top: 18px; border-top: 1px solid var(--border); }

.toggle-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-row > span:last-child { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.toggle-row strong { color: var(--strong); font-size: 15px; font-weight: 600; }
.toggle-row small { color: var(--muted); font-size: 13px; }
.toggle-ui { position: relative; width: 40px; height: 24px; border-radius: 12px; background: var(--toggle-off); flex-shrink: 0; transition: background-color 0.15s ease; margin-top: 2px; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.15s ease; }
.toggle-row input:checked + .toggle-ui { background: var(--green); }
.toggle-row input:checked + .toggle-ui::after { transform: translateX(16px); }
.toggle-row input:focus-visible + .toggle-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.host-status { margin: 10px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.host-status.ok { color: var(--ok-text); }
.host-status.bad { color: var(--red); }

.welcome-modal .modal-body { text-align: left; }
.welcome-logo { color: var(--accent); display: flex; justify-content: center; margin-bottom: 16px; }

/* ------------------------------------------------------------ popover, toasts */

.popover {
  position: fixed;
  z-index: 150;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bg-float);
  box-shadow: 0 0 0 1px var(--border), 0 8px 24px var(--shadow);
  animation: pop 0.1s ease;
}
.pop-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  margin: 2px 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--icon);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.pop-item:hover { background: var(--accent); color: #fff; }
.pop-item.accent { color: var(--accent-text); }
.pop-item.accent:hover { color: #fff; }
.pop-item.danger { color: var(--red); }
.pop-item.danger:hover { background: var(--red); color: #fff; }
.pop-sep { height: 1px; margin: 4px; background: var(--border); }

.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 250; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: min(480px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--bg-float);
  color: var(--strong);
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: rise 0.15s ease;
}
.toast.out { opacity: 0; transition: opacity 0.2s ease; }

.insecure { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.insecure h1 { color: var(--strong); }
.insecure p { color: var(--muted); max-width: 520px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); } 40% { opacity: 1; transform: scale(1); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------ status dots */

.sdot {
  position: relative;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--green);
}
.sdot.idle { background: var(--yellow); }
.sdot.idle::after { content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%; top: -1px; left: -1px; background: var(--dot-cut, var(--bg-float)); }
.sdot.dnd { background: var(--red); }
.sdot.dnd::after { content: ""; position: absolute; left: 2px; right: 2px; top: 4px; height: 2px; border-radius: 1px; background: var(--dot-cut, var(--bg-float)); }
.sdot.offline { background: transparent; box-shadow: inset 0 0 0 2.5px #80848e; }
.sdot.on-panel, .sdot.on-list, .sdot.on-popout {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 16px;
  height: 16px;
  border: 3px solid var(--bg-panel);
  box-sizing: border-box;
}
.sdot.on-panel { --dot-cut: var(--bg-panel); }
.sdot.on-list { border-color: var(--bg-side); --dot-cut: var(--bg-side); }
.sdot.on-panel.idle::after, .sdot.on-list.idle::after { width: 6px; height: 6px; top: -1px; left: -1px; }
.sdot.on-panel.dnd::after, .sdot.on-list.dnd::after { left: 1px; right: 1px; top: 4px; }
.sdot.on-panel.offline, .sdot.on-list.offline { background: var(--bg-panel); box-shadow: inset 0 0 0 2.5px #80848e; }
.sdot.on-list.offline { background: var(--bg-side); }
.sdot.on-popout {
  right: 2px;
  bottom: 2px;
  width: 24px;
  height: 24px;
  border-width: 5px;
  border-color: var(--popout);
  --dot-cut: var(--popout);
}
.sdot.on-popout.idle::after { width: 9px; height: 9px; top: -2px; left: -2px; }
.sdot.on-popout.dnd::after { left: 2px; right: 2px; top: 6px; height: 2px; }
.sdot.on-popout.offline { background: var(--popout); box-shadow: inset 0 0 0 3.5px #80848e; }
.sdot.po-ico { width: 12px; height: 12px; margin: 0 3px; --dot-cut: var(--popout-card); }
.sdot.po-ico.idle::after { width: 7px; height: 7px; }
.sdot.po-ico.dnd::after { top: 5px; }
.po-fly-item .sdot.po-ico { --dot-cut: var(--popout-card); }
.po-fly-item:hover .sdot.po-ico { --dot-cut: var(--accent); }

.up-status.warn { color: var(--yellow); }

/* ------------------------------------------------------------ avatars with pictures */

.avatar.has-img { background: var(--rail-item); overflow: hidden; }
.avatar.has-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar.clickable, .msg-avatar { cursor: pointer; }
.msg-author { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: var(--strong); font-size: 15px; font-weight: 600; }
.msg-author:hover { text-decoration: underline; }
.unverified { color: var(--yellow); font-size: 11px; font-weight: 700; background: rgba(240, 178, 50, 0.12); border-radius: 4px; padding: 0 5px; cursor: help; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--chip);
  border: 1px solid var(--chip-border);
  color: var(--strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1;
  vertical-align: middle;
}
.tag-emoji { font-size: 11px; }
.mem-name { gap: 6px; }
.mem-name-text { overflow: hidden; text-overflow: ellipsis; }
.mem { cursor: pointer; }

/* ------------------------------------------------------------ profile popout */

.popout {
  position: fixed;
  z-index: 170;
  width: 300px;
  background: var(--popout);
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--border), 0 16px 40px var(--shadow);
  padding-bottom: 12px;
  animation: pop 0.12s ease;
}
.popout.preview { position: relative; z-index: auto; animation: none; box-shadow: 0 0 0 1px var(--border); }
.po-banner { height: 105px; border-radius: 10px 10px 0 0; opacity: 0.95; }
.po-top { position: relative; height: 52px; padding: 0 16px; }
.po-avatar-wrap { position: absolute; left: 16px; top: -46px; border-radius: 50%; padding: 6px; background: var(--popout); }
.po-avatar { width: 80px; height: 80px; font-size: 28px; }
.po-bubble-wrap { position: absolute; left: 112px; right: 16px; top: -24px; }
.pb-dot1, .pb-dot2 { position: absolute; border-radius: 50%; background: var(--popout-card); }
.pb-dot1 { width: 8px; height: 8px; left: -12px; top: 8px; }
.pb-dot2 { width: 14px; height: 14px; left: -3px; top: 16px; }
.po-bubble {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-top: 12px;
  padding: 8px 12px;
  border: 0;
  border-radius: 14px;
  background: var(--popout-card);
  color: var(--text);
  font: 14px var(--font);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow);
}
.po-bubble:hover { background: var(--popout-card-hover); }
.po-bubble.static { cursor: default; }
.pb-plus { color: var(--icon); }
.pb-ph { color: var(--muted); font-style: italic; }
.pb-emoji { font-size: 18px; line-height: 1; }
.pb-text { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.po-id { padding: 0 16px; }
.po-name { color: var(--strong); font-size: 20px; font-weight: 700; line-height: 1.25; word-break: break-word; }
.po-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; color: var(--text); font-size: 14px; }
.po-dot { color: var(--muted); }
.uname.bad { color: var(--red); text-decoration: line-through; cursor: help; }
.po-bio { padding: 10px 16px 0; color: var(--text); font-size: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.po-menu {
  margin: 12px 12px 0;
  padding: 4px;
  border-radius: 8px;
  background: var(--popout-card);
}
.po-menu + .po-menu { margin-top: 8px; }
.po-row {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: 500 14px var(--font);
  text-align: left;
  cursor: pointer;
}
.po-row:hover, .po-fly-wrap:hover > .po-row { background: var(--bg-hover); color: var(--strong); }
.po-ico { color: var(--icon); }
.po-row-label { flex: 1; }
.po-chev { color: var(--muted); }
.po-sep { height: 1px; margin: 2px 10px; background: var(--sep); }
.po-fly-wrap { position: relative; }
.po-flyout { position: absolute; left: 100%; top: -8px; padding-left: 14px; z-index: 2; animation: pop 0.08s ease; }
.po-flyout.flip { left: auto; right: 100%; padding-left: 0; padding-right: 14px; }
.po-fly-inner {
  width: 250px;
  padding: 6px;
  border-radius: 8px;
  background: var(--popout-card);
  box-shadow: 0 0 0 1px var(--border), 0 12px 32px var(--shadow);
}
.po-fly-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text);
  font: 500 14px var(--font);
  text-align: left;
  cursor: pointer;
}
.po-fly-item:hover { background: var(--accent); color: #fff; }
.po-fly-item:hover small { color: rgba(255, 255, 255, 0.85); }
.po-fly-item.danger { color: var(--red); }
.po-fly-item.danger:hover { background: var(--red); color: #fff; }
.po-fly-item.danger .po-ico { color: inherit; }
.pfi-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pfi-text small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.3; }
.pfi-check { color: var(--green); }
.po-fly-sep { height: 1px; margin: 4px 6px; background: var(--sep); }

/* ------------------------------------------------------------ edit profile, custom status, settings */

.profile-modal { width: min(760px, 100%); }
.pe-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.pe-preview { position: sticky; top: 0; }
.pe-btns { display: flex; align-items: center; gap: 8px; }
.textarea { height: auto; min-height: 90px; resize: vertical; line-height: 1.4; font-size: 14px; }
.char-count { float: right; color: var(--muted); font-weight: 600; text-transform: none; }
.color-input { width: 64px; height: 36px; padding: 2px; border: 0; border-radius: 6px; background: var(--bg-deep); cursor: pointer; }
.input[readonly] { color: var(--muted); cursor: default; }
@media (max-width: 720px) { .pe-grid { grid-template-columns: 1fr; } }

.cs-row { display: flex; align-items: center; gap: 8px; padding: 4px; background: var(--bg-deep); border-radius: 6px; }
.cs-row .input { background: transparent; }
.cs-row .input:focus { box-shadow: none; }
.cs-emoji { width: 40px; height: 40px; border: 0; border-radius: 6px; background: none; color: var(--icon); font-size: 22px; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.cs-emoji:hover { background: var(--bg-hover); }

.acct-card { border-radius: 8px; overflow: hidden; background: var(--bg-deep); }
.acct-banner { height: 70px; }
.acct-row { display: flex; align-items: flex-end; gap: 12px; padding: 0 16px 14px; margin-top: -36px; }
.acct-row .avatar { box-shadow: 0 0 0 6px var(--bg-deep); }
.acct-text { flex: 1; min-width: 0; padding-bottom: 4px; }
.acct-name { color: var(--strong); font-size: 18px; font-weight: 700; }
.acct-user { color: var(--muted); font-size: 13px; }
.acct-user::before { content: "@"; }
.acct-user:empty::before { content: ""; }

.tag-row { display: flex; gap: 8px; align-items: center; }
.tag-row .tag-input { width: 110px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.06em; }
.tag-emoji-btn { width: 44px; padding: 0; font-size: 18px; display: grid; place-items: center; }
.tag-preview-box { margin-top: 12px; padding: 12px; border-radius: 8px; background: var(--bg-deep); display: flex; flex-direction: column; gap: 6px; }
.tag-preview { display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------ sign up / log in */

.auth {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 24px 16px;
}
.desktop .auth { top: 30px; }
.has-banner .auth { top: 36px; }
.desktop .has-banner .auth { top: 66px; }
.titlebar, .update-bar { position: relative; z-index: 95; }
.auth-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--bg-rail);
}
.auth-card {
  width: min(480px, 100%);
  padding: 32px;
  border-radius: 10px;
  background: var(--bg-modal);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: rise 0.25s ease;
}
.auth-logo { color: var(--accent); display: flex; justify-content: center; margin-bottom: 8px; }
.auth-logo .logo-hole { fill: var(--bg-modal); }
.auth-card h1 { color: var(--strong); text-align: center; font-size: 24px; font-weight: 700; margin: 0 0 6px; }
.auth-sub { color: var(--muted); text-align: center; font-size: 15px; margin: 0 0 20px; }
.auth-card h1 + .auth-server, .auth-card h1 + .auth-field { margin-top: 20px; }
.auth-field { display: block; margin-bottom: 18px; }
.auth-field .field-label { margin-top: 0; }
.auth-hint { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.auth-hint.ok { color: var(--ok-text); }
.auth-hint.bad { color: var(--red); }
.at-input { display: flex; align-items: center; background: var(--bg-deep); border-radius: 6px; }
.at-input span { padding-left: 10px; color: var(--muted); font-size: 15px; }
.at-input .input { padding-left: 2px; }
.auth-error { color: var(--red); font-size: 14px; margin: -6px 0 12px; }
.auth-error:empty { display: none; }
.auth-submit { height: 44px; font-size: 16px; display: grid; place-items: center; }
.auth-foot { margin-top: 12px; color: var(--muted); font-size: 14px; }
.auth-link { border: 0; background: none; padding: 0; color: var(--link); font: inherit; font-size: 14px; cursor: pointer; }
.auth-link:hover { text-decoration: underline; }
.auth-card > .auth-link { display: block; margin-top: 10px; }
.auth-server { margin-bottom: 18px; border-radius: 8px; background: var(--bg-deep); }
.auth-server summary { padding: 10px 12px; color: var(--icon); font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; list-style: none; }
.auth-server summary::-webkit-details-marker { display: none; }
.auth-server-body { padding: 4px 12px 14px; }
.auth-server-body .input { background: var(--bg-modal); }
.spinner.light { border-color: rgba(255, 255, 255, 0.3); border-top-color: #fff; }

/* ------------------------------------------------------------ server header, categories, icons */

.server-header { display: flex; align-items: center; width: 100%; height: 100%; padding: 0 8px 0 0; border-top-left-radius: 8px; cursor: default; }
.server-header:hover { background: none; }
.sh-name {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 16px;
  border: 0;
  background: none;
  color: var(--strong);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-top-left-radius: 8px;
}
.sh-name:hover { background: var(--bg-hover); }
.cat { cursor: pointer; padding-top: 18px; }
.cat-label { display: flex; align-items: center; gap: 2px; }
.cat-chev { transition: transform 0.15s ease; }
.cat.collapsed .cat-chev { transform: rotate(-90deg); }
.rail-icon { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; pointer-events: none; }
.rail-item:has(.rail-icon) { overflow: hidden; background: var(--rail-item); }
.auth-server-change { margin-left: auto; color: var(--link); font-weight: 500; }
.ss-icon-row { display: flex; align-items: center; gap: 16px; margin-bottom: 4px; }

/* ------------------------------------------------------------ create-server wizard */

.wizard { width: min(460px, 100%); padding-bottom: 0; }
.wiz .modal-title { margin-top: 0; }
.wiz-list { max-height: 330px; overflow-y: auto; margin: 16px -4px 0; padding: 0 4px; }
.wiz-opt {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-side);
  color: var(--strong);
  font: 600 15px var(--font);
  text-align: left;
  cursor: pointer;
}
.wiz-opt:hover { background: var(--bg-hover); }
.wiz-emoji { width: 32px; height: 32px; display: grid; place-items: center; font-size: 24px; line-height: 1; }
.wiz-label { flex: 1; }
.wiz-chev { color: var(--muted); }
.wiz-section { margin: 14px 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.wiz-skip { text-align: center; color: var(--text); font-size: 14px; margin: 12px 0 0; }
.wiz-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 20px -16px 0;
  padding: 16px;
  background: var(--bg-modal-foot);
  border-radius: 0 0 10px 10px;
}
.wiz-foot.center { flex-direction: column; text-align: center; }
.wiz-foot.center h3 { margin: 0 0 4px; color: var(--strong); font-size: 18px; }
.wiz-upload-row { display: flex; justify-content: center; margin: 20px 0 8px; }
.wiz-upload {
  position: relative;
  width: 80px;
  height: 80px;
  border: 2px dashed var(--icon);
  border-radius: 50%;
  background: none;
  color: var(--icon);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.wiz-upload:hover { border-color: var(--strong); color: var(--strong); }
.wiz-upload.has-img { border: 0; }
.wiz-upload img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.wiz-upload.small { width: 64px; height: 64px; flex-shrink: 0; }
.wiz-up-inner { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 700; }
.wiz-plus { position: absolute; top: -2px; right: -2px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.wiz-fine { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.wiz-fine .ico { color: var(--green); }

/* ------------------------------------------------------------ server welcome checklist */

.welcome { margin: auto; padding: 32px 16px; width: min(420px, 100%); text-align: center; align-self: center; }
.welcome h1 { color: var(--strong); font-size: 28px; font-weight: 800; line-height: 1.2; margin: 0 0 8px; }
.welcome p { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.wl-list { display: flex; flex-direction: column; gap: 8px; }
.wl-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--bg-side);
  color: var(--strong);
  font: 600 14px var(--font);
  text-align: left;
  cursor: pointer;
}
.wl-item:hover { background: var(--bg-hover); }
.wl-item.done .wl-label { color: var(--muted); }
.wl-emoji { font-size: 20px; width: 28px; text-align: center; }
.wl-label { flex: 1; }
.wl-chev { color: var(--muted); }
.wl-check { width: 22px; height: 22px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; }

/* ------------------------------------------------------------ smaller screens */

@media (max-width: 1100px) {
  .app, .app.hide-members { grid-template-columns: 72px 240px minmax(0, 1fr); }
  .members { display: none; }
}

@media (max-width: 760px) {
  .app, .app.hide-members { grid-template-columns: minmax(0, 1fr); }
  .rail, .sidebar { position: fixed; top: 0; bottom: 0; z-index: 60; transform: translateX(-320px); transition: transform 0.2s ease; }
  .desktop .rail, .desktop .sidebar { top: 30px; }
  .rail { left: 0; width: 72px; }
  .sidebar { left: 72px; width: min(260px, calc(100vw - 72px)); border-radius: 0; }
  .app.nav-open .rail, .app.nav-open .sidebar { transform: none; }
  .main { grid-column: 1; }
  .mobile-only { display: grid; }
  .e2e, .hd-divider, .hd-search { display: none; }
  .msg { padding-right: 16px; }
}
