/* Talkie theme system
   Base colors come from [data-theme] plus optional inline overrides written by
   app.js (accent, chat, panels, text). Every other tone is derived with
   color-mix() so custom themes only need four colors. */

:root {
  --accent: #5865f2;
  --chat: #0c1016;
  --panel: #10141c;
  --text: #d6e2d8;
  --strong: #f2f3f5;
  --shade: 22%;
  --green: #23a559;
  --red: #ff3b3b;
  --warn: #ffb000;
  --on-accent: #000000;

  --rail: color-mix(in srgb, var(--panel), #000 var(--shade));
  --input: color-mix(in srgb, var(--chat), var(--text) 8%);
  --hover: color-mix(in srgb, var(--panel), var(--text) 8%);
  --active: color-mix(in srgb, var(--panel), var(--text) 16%);
  --chat-hover: color-mix(in srgb, var(--chat), var(--text) 4%);
  --card: var(--chat);
  --muted: color-mix(in srgb, var(--text) 58%, var(--panel));
  --faint: color-mix(in srgb, var(--text) 36%, var(--panel));
  --border: rgba(128, 132, 142, 0.2);
  --accent-hover: color-mix(in srgb, var(--accent), #fff 8%);
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --danger-soft: color-mix(in srgb, var(--red) 18%, transparent);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  --radius: 2px;

  --audio-accent: #5865f2;
  --audio-accent-2: #5ee7ff;
  color-scheme: dark;
}

[data-theme="light"] {
  --chat: #ffffff;
  --panel: #f2f3f5;
  --text: #4e5058;
  --strong: #060607;
  --shade: 7%;
  --on-accent: #ffffff;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  --audio-accent: #0a84ff;
  --audio-accent-2: #5e5ce6;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background: var(--chat);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

textarea {
  resize: none;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(128, 132, 142, 0.45) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(128, 132, 142, 0.45);
  border-radius: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

/* Avatars */

.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  user-select: none;
  background: var(--accent);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Auth */

.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  background: var(--rail);
  overflow-y: auto;
}

.auth-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  pointer-events: none;
}

.auth-glow-one {
  top: -120px;
  left: -120px;
  background: var(--accent);
}

.auth-glow-two {
  bottom: -160px;
  right: -120px;
  background: #eb459e;
}

.auth-card {
  position: relative;
  width: min(420px, 100%);
  margin: auto;
  padding: 32px;
  border-radius: 8px;
  background: var(--chat);
  box-shadow: var(--shadow);
  text-align: center;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
}

.brand-logo svg {
  width: 34px;
  height: 34px;
  fill: #fff;
}

.auth-card h1 {
  margin: 14px 0 2px;
  color: var(--strong);
  font-size: 28px;
}

.auth-sub {
  margin: 0 0 22px;
  color: var(--muted);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 6px;
  background: var(--rail);
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  background: var(--active);
  color: var(--strong);
}

#auth-form {
  display: grid;
  gap: 14px;
  text-align: left;
}

.auth-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}

/* Forms */

.field {
  display: grid;
  gap: 6px;
}

.field > span,
.color-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea,
.link-row input,
.topic-new-input,
.topic-new-emoji,
.topic-manage-name,
.topic-manage-emoji,
.permission-select,
.role-select,
.invite-link-row input {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 3px;
  background: var(--input);
  color: var(--strong);
  outline: none;
  transition: box-shadow 0.15s ease;
}

.field textarea {
  min-height: 74px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.link-row input:focus,
.invite-link-row input:focus {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.field input::placeholder,
.field textarea::placeholder,
.topic-new-input::placeholder {
  color: var(--faint);
}

.field.readonly .readonly-value {
  padding: 10px 12px;
  border-radius: 3px;
  background: var(--input);
  color: var(--muted);
  word-break: break-all;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.form-error {
  min-height: 0;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.form-error:empty {
  display: none;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 3px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.primary-btn {
  background: var(--accent);
  color: var(--on-accent);
}

.primary-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.primary-btn:disabled {
  opacity: 0.5;
}

.ghost-btn {
  background: transparent;
  color: var(--text);
}

.ghost-btn:hover:not(:disabled) {
  background: var(--hover);
  color: var(--strong);
}

.ghost-btn.small,
.primary-btn.small {
  min-height: 30px;
  padding: 0 12px;
  font-size: 13px;
}

.danger-btn {
  background: var(--red);
  color: #fff;
}

.danger-btn:hover {
  filter: brightness(1.08);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}

.icon-btn:hover:not(:disabled) {
  background: var(--hover);
  color: var(--strong);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.icon-btn.active,
.icon-btn.on {
  color: var(--strong);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* App shell */

.app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 72px 240px minmax(0, 1fr) auto;
  background: var(--chat);
}

.app.members-hidden {
  grid-template-columns: 72px 240px minmax(0, 1fr);
}

/* Server rail */

.server-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  background: var(--rail);
  overflow-y: auto;
  scrollbar-width: none;
}

.server-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.server-divider {
  width: 32px;
  height: 2px;
  border-radius: 1px;
  background: var(--border);
}

.server-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--chat);
  color: var(--text);
  overflow: visible;
  transition: border-radius 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.server-btn:hover {
  border-radius: 16px;
  background: var(--accent);
  color: var(--on-accent);
}

.server-btn.active {
  border-radius: 16px;
  background: var(--accent);
  color: var(--on-accent);
}

.server-btn::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 4px;
  height: 8px;
  margin-top: -4px;
  border-radius: 0 4px 4px 0;
  background: var(--strong);
  transform: scaleY(0);
  transition: transform 0.18s ease, height 0.18s ease;
}

.server-btn:hover::before {
  height: 20px;
  margin-top: -10px;
  transform: scaleY(1);
}

.server-btn.active::before {
  height: 40px;
  margin-top: -20px;
  transform: scaleY(1);
}

.server-btn.home svg,
.server-btn.add svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.server-btn.add {
  background: var(--chat);
  color: var(--green);
}

.server-btn.add:hover {
  background: var(--green);
  color: #fff;
}

.server-btn .server-icon {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  color: #fff;
}

.server-btn .server-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.server-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border: 3px solid var(--rail);
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 10px;
  text-align: center;
  box-sizing: content-box;
}

/* Sidebar (channels / direct messages) */

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--panel);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 48px;
  padding: 0 8px 0 12px;
  border-bottom: 1px solid var(--rail);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

.sidebar-title {
  flex: 1;
  min-width: 0;
  padding: 6px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
}

.sidebar-title strong {
  display: block;
  overflow: hidden;
  color: var(--strong);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-title:hover {
  background: var(--hover);
}

.search-row {
  padding: 8px 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  height: 30px;
  border-radius: 4px;
  background: var(--rail);
}

.search-box svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: var(--muted);
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font-size: 14px;
}

.search-box input::placeholder {
  color: var(--faint);
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 8px;
}

.list-label {
  padding: 16px 8px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-list.search-results {
  position: absolute;
  top: 98px;
  left: 8px;
  right: 8px;
  bottom: 64px;
  z-index: 5;
  overflow-y: auto;
  padding: 6px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chat-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 42px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.chat-item:hover {
  background: var(--hover);
  color: var(--text);
}

.chat-item.active {
  background: var(--active);
  color: var(--strong);
}

.chat-item.blocked .chat-item-preview {
  color: var(--red);
}

.chat-list-avatar {
  width: 32px;
  height: 32px;
}

.chat-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chat-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.chat-item-name {
  overflow: hidden;
  color: inherit;
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-item.active .chat-item-name {
  color: var(--strong);
}

.chat-item-time {
  color: var(--faint);
  font-size: 11px;
  white-space: nowrap;
}

.chat-item-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.chat-item-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--faint);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-item-arrow {
  display: none;
}

.unread-badge {
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.empty-list {
  padding: 16px 8px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* Channels and topics inside a server */

.group-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.channel-bar {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channel-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-chip:hover {
  background: var(--hover);
  color: var(--text);
}

.channel-chip.active {
  background: var(--active);
  color: var(--strong);
}

.topic-new-form {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.topic-new-emoji {
  width: 44px;
  flex: 0 0 auto;
  padding: 6px;
  text-align: center;
}

.topic-new-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
}

.topic-new-input:focus,
.topic-new-emoji:focus {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.topic-manage-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 6px;
  background: var(--panel);
}

.topic-manage-closed {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.topic-manage-new {
  margin-top: 4px;
}

.topic-manage-new .topic-new-input {
  flex: 1;
}

/* User panel */

.user-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 8px 0 8px;
  background: var(--rail);
}

.user-panel .me-avatar {
  width: 32px;
  height: 32px;
  cursor: default;
}

.me-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.me-info strong {
  overflow: hidden;
  color: var(--strong);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-info span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 0;
}

.user-panel .sidebar-actions .icon-btn {
  width: 28px;
  height: 28px;
}

.user-panel .sidebar-actions .icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Chat panel */

.chat-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--chat);
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
  text-align: center;
}

.empty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.empty-badge svg {
  width: 36px;
  height: 36px;
  fill: #fff;
}

.empty-state h2 {
  margin: 0;
  color: var(--strong);
  font-size: 24px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  max-width: 360px;
}

.chat-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--rail);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
  flex: 0 0 auto;
  min-width: 0;
}

.back-btn {
  display: none;
}

.chat-person {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
}

.chat-person:hover {
  background: var(--hover);
}

.chat-hash {
  display: none;
  color: var(--muted);
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
}

.chat-avatar {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.chat-person-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.chat-person-info strong {
  overflow: hidden;
  color: var(--strong);
  font-size: 16px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-person-info span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-view.is-channel .chat-hash {
  display: inline;
}

.chat-view.is-channel .chat-avatar {
  display: none;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding-left: 8px;
}

.chat-header-actions .icon-btn {
  width: 32px;
  height: 32px;
}

.chat-header-actions .icon-btn.active {
  color: var(--strong);
}

.blocked-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 16px 0;
  padding: 10px 14px;
  border-radius: 4px;
  background: var(--danger-soft);
  color: var(--text);
  font-size: 14px;
}

.message-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 0 8px;
  overscroll-behavior: contain;
}

.message-list > .empty-list {
  padding: 40px 16px;
}

.day-divider {
  position: relative;
  display: flex;
  align-items: center;
  margin: 16px 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);
}

.day-divider span {
  padding: 0 12px;
}

/* Messages */

.msg-row {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 2px 16px 2px 16px;
  margin-top: 16px;
  min-width: 0;
}

.msg-row:hover {
  background: var(--chat-hover);
}

.msg-row.continued {
  margin-top: 0;
  padding-top: 1px;
  padding-bottom: 1px;
}

.msg-avatar-col {
  flex: 0 0 40px;
  width: 40px;
}

.msg-avatar {
  width: 40px;
  height: 40px;
  font-size: 15px;
  margin-top: 2px;
  cursor: pointer;
}

.msg-row.continued .msg-avatar-col {
  position: relative;
}

.msg-row.continued .msg-avatar-col .msg-time-hover {
  position: absolute;
  left: 0;
  width: 40px;
  padding-top: 4px;
  color: var(--faint);
  font-size: 10px;
  text-align: center;
  opacity: 0;
}

.msg-row.continued:hover .msg-time-hover {
  opacity: 1;
}

.msg-stack {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  line-height: 1.2;
}

.msg-sender {
  overflow: hidden;
  color: var(--strong);
  font-size: 18px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.msg-sender:hover {
  text-decoration: underline;
}

.msg-sender.me {
  color: var(--accent);
}

.msg-time {
  color: var(--faint);
  font-size: 13px;
  white-space: nowrap;
}

.bubble {
  position: relative;
  min-width: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
}

.bubble-text {
  white-space: pre-wrap;
}

.bubble-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
}

.bubble-meta:empty {
  display: none;
}

.checks {
  color: var(--faint);
  letter-spacing: -2px;
}

.checks.read {
  color: var(--accent);
}

.msg-row.highlight {
  background: var(--accent-soft);
  transition: background 0.6s ease;
}

.msg-row.highlight .bubble {
  color: var(--strong);
}

@keyframes message-highlight {
  from {
    background: var(--accent-soft);
  }
  to {
    background: transparent;
  }
}

.bubble-reply {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-bottom: 4px;
  padding: 0;
  border: 0;
  border-left: 2px solid var(--faint);
  padding-left: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
}

.bubble-reply:hover .bubble-reply-text {
  color: var(--text);
}

.bubble-reply-name {
  flex: 0 0 auto;
  color: var(--strong);
  font-weight: 600;
}

.bubble-reply-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.bubble-image {
  display: block;
  max-width: min(420px, 100%);
  max-height: 340px;
  margin: 4px 0;
  border-radius: 6px;
  object-fit: contain;
  background: var(--rail);
  cursor: zoom-in;
}

.bubble-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--accent);
  font-size: 14px;
  text-decoration: none;
  max-width: 100%;
}

.bubble-file:hover {
  text-decoration: underline;
}

/* Voice messages */

.bubble-audio {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(340px, 100%);
  margin: 4px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  --audio-progress: 0;
}

.bubble-audio.error {
  opacity: 0.6;
}

.bubble-audio-media {
  display: none;
}

.bubble-audio-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--audio-accent), var(--audio-accent-2));
  color: #fff;
}

.bubble-audio-play-icon {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-left: 10px solid #fff;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.bubble-audio.playing .bubble-audio-play-icon {
  width: 9px;
  height: 11px;
  margin-left: 0;
  border: 0;
  border-left: 3px solid #fff;
  border-right: 3px solid #fff;
  border-radius: 1px;
  box-sizing: border-box;
}

.bubble-audio-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bubble-audio-wave {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  cursor: pointer;
  touch-action: none;
}

.bubble-audio-wave-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--audio-progress) * 1%);
  border-radius: 3px;
  background: linear-gradient(90deg, var(--audio-accent), var(--audio-accent-2));
}

.bubble-audio-wave-thumb {
  position: absolute;
  top: 50%;
  left: calc(var(--audio-progress) * 1%);
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--strong);
  box-shadow: 0 0 0 2px var(--panel);
}

.bubble-audio-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.bubble-audio-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bubble-audio-time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Call log in direct messages */

.call-log {
  margin: 12px 16px;
}

.call-log-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--panel);
  max-width: 360px;
}

.call-log-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.call-log.missed .call-log-icon {
  background: var(--red);
}

.call-log-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.call-log-title {
  color: var(--strong);
  font-size: 14px;
}

.call-log-meta {
  color: var(--muted);
  font-size: 12px;
}

/* Attachments and composer */

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  margin: 0 0 6px;
  border-radius: 6px;
  background: var(--panel);
}

.attachment-thumb {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: cover;
}

.attachment-audio {
  flex: 1;
  color: var(--text);
  font-size: 14px;
}

.attachment-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.attachment-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.attachment-info strong {
  overflow: hidden;
  color: var(--strong);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-info span {
  color: var(--muted);
  font-size: 12px;
}

.attachment-remove {
  flex: 0 0 auto;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin: 0 16px 24px;
  padding: 0 8px 0 4px;
  border-radius: 8px;
  background: var(--input);
  flex: 0 0 auto;
}

.composer-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.reply-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.reply-preview-body {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
}

.reply-preview-body strong {
  color: var(--strong);
}

.reply-preview-body span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-preview-close {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

#message-input {
  width: 100%;
  min-height: 44px;
  max-height: 140px;
  padding: 12px 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font-size: 16px;
  line-height: 1.375;
}

#message-input:focus {
  outline: none;
}

#message-input::placeholder {
  color: var(--faint);
}

#message-input:disabled {
  opacity: 0.6;
}

.composer-btn {
  width: 36px;
  height: 44px;
  align-self: flex-end;
  border-radius: 0;
}

.composer-btn.recording {
  color: var(--red);
  animation: pulse-recording 1.2s ease-in-out infinite;
}

@keyframes pulse-recording {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 44px;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--accent);
}

.send-btn:hover:not(:disabled) {
  color: var(--accent-hover);
}

.send-btn:disabled {
  color: var(--faint);
}

.send-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Members panel */

.members-panel {
  width: 240px;
  min-height: 0;
  background: var(--panel);
  display: flex;
  flex-direction: column;
}

.members-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 8px;
}

.members-group-title {
  padding: 16px 8px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.panel-member {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  color: var(--text);
  opacity: 1;
  transition: opacity 0.15s ease;
}

.panel-member:hover {
  background: var(--hover);
}

.panel-member.offline {
  opacity: 0.5;
}

.panel-member-avatar {
  position: relative;
  width: 32px;
  height: 32px;
}

.panel-member-status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--faint);
  box-sizing: content-box;
}

.panel-member-status.online {
  background: var(--green);
}

.panel-member-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Modals */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  max-height: calc(100vh - 48px);
  border-radius: 6px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 8px 16px;
}

.modal-head h2 {
  margin: 0;
  color: var(--strong);
  font-size: 22px;
  font-weight: 700;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
}

.modal-body {
  display: grid;
  gap: 16px;
  padding: 8px 16px 16px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 16px;
  background: var(--panel);
}

.modal-foot .ghost-btn:first-child:last-child {
  margin-right: auto;
}

.banner-preview {
  position: relative;
  height: 120px;
  background: linear-gradient(135deg, var(--accent), #eb459e);
  background-size: cover;
  background-position: center;
}

.banner-preview.has-image {
  background-color: var(--panel);
}

#edit-banner {
  cursor: pointer;
}

.banner-edit {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border: 0;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.avatar-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: -40px 16px 0;
}

.avatar-row > .profile-avatar {
  width: 88px;
  height: 88px;
  font-size: 30px;
  border: 6px solid var(--card);
}

.profile-avatar {
  width: 88px;
  height: 88px;
  font-size: 30px;
}

.avatar-row > .ghost-btn {
  margin-bottom: 8px;
  background: var(--panel);
}

.user-card .modal-body {
  padding-top: 4px;
}

.user-avatar-row {
  align-items: flex-end;
}

.user-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 6px;
}

.user-heading h2 {
  margin: 0;
  color: var(--strong);
  font-size: 22px;
}

.user-card .user-banner {
  height: 120px;
}

.user-card .modal-body .chips {
  margin-top: 0;
}

.user-bio {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.user-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-foot {
  justify-content: space-between;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--input);
  color: var(--text);
  font-size: 13px;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--input);
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
}

.link-pill:hover {
  text-decoration: underline;
}

.links-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.links-editor {
  display: grid;
  gap: 8px;
}

.links-empty {
  color: var(--muted);
  font-size: 13px;
}

.link-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 6px;
  align-items: center;
}

.link-remove {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}

.link-remove:hover {
  background: var(--danger-soft);
  color: var(--red);
}

.group-section-title {
  margin: 4px 0 -4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.group-list {
  display: grid;
  gap: 8px;
}

.group-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 14px;
}

.group-form {
  display: grid;
  gap: 10px;
}

.group-form select,
.field select {
  padding: 10px 12px;
  border: 0;
  border-radius: 3px;
  background: var(--input);
  color: var(--strong);
  outline: none;
}

.group-avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.modal-tab {
  padding: 10px 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.modal-tab:hover {
  color: var(--text);
}

.modal-tab.active {
  color: var(--strong);
  border-bottom-color: var(--accent);
}

.group-card .modal-body {
  max-height: 60vh;
}

.group-modal-body,
.permissions-body {
  min-height: 160px;
}

.member-row,
.role-card,
.channel-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 6px;
  background: var(--panel);
}

.member-row {
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.member-avatar {
  width: 36px;
  height: 36px;
}

.member-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.member-info strong {
  overflow: hidden;
  color: var(--strong);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-info span {
  color: var(--muted);
  font-size: 12px;
}

.role-color {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.role-top,
.channel-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-top input,
.channel-top input {
  flex: 1;
  min-width: 0;
}

.role-permissions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 12px;
}

.role-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.channel-card > input {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 3px;
  background: var(--input);
  color: var(--strong);
  outline: none;
}

.channel-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.permission-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
}

.permission-table th,
.permission-table td {
  padding: 8px;
  text-align: left;
  font-size: 13px;
}

.permission-table th {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.permission-table td {
  background: var(--panel);
}

.permission-table td:first-child {
  border-radius: 4px 0 0 4px;
}

.permission-table td:last-child {
  border-radius: 0 4px 4px 0;
}

.permission-target {
  color: var(--strong);
  font-weight: 600;
}

.permission-select {
  width: auto;
  min-width: 120px;
  padding: 6px 8px;
}

/* Settings and themes */

.settings-card {
  width: min(560px, 100%);
}

.settings-body {
  max-height: 68vh;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.theme-card {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.theme-card:hover {
  border-color: var(--border);
}

.theme-card.active {
  border-color: var(--accent);
}

.theme-card-swatch {
  position: relative;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
}

.theme-card-swatch::before,
.theme-card-swatch::after {
  content: "";
  position: absolute;
}

.theme-card-swatch::before {
  left: 0;
  top: 0;
  bottom: 0;
  width: 30%;
  background: var(--swatch-panel);
}

.theme-card-swatch::after {
  left: 30%;
  right: 0;
  top: 0;
  bottom: 0;
  background: var(--swatch-chat);
  box-shadow: inset 12px 12px 0 -6px var(--swatch-accent);
}

.theme-card-name {
  color: var(--strong);
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-card-meta {
  color: var(--muted);
  font-size: 12px;
}

.theme-editor {
  display: grid;
  gap: 14px;
}

.theme-colors {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.color-field {
  display: grid;
  gap: 6px;
}

.color-field input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 2px;
  border: 0;
  border-radius: 3px;
  background: var(--input);
  cursor: pointer;
}

.theme-preview {
  display: grid;
  grid-template-columns: 56px 1fr 1.6fr;
  height: 130px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--chat);
  box-shadow: inset 0 0 0 1px var(--border);
}

.theme-preview-rail {
  background: var(--rail);
}

.theme-preview-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 10px;
  background: var(--panel);
}

.theme-preview-line {
  height: 8px;
  border-radius: 4px;
  background: var(--hover);
}

.theme-preview-line.short {
  width: 60%;
}

.theme-preview-chat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 14px;
}

.theme-preview-msg {
  width: 80%;
  height: 10px;
  border-radius: 4px;
  background: var(--text);
  opacity: 0.6;
}

.theme-preview-btn {
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 3px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 600;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  transform: translateX(-50%);
  max-width: min(460px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 4px;
  background: var(--rail);
  color: var(--strong);
  font-size: 14px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: toast-in 0.18s ease-out;
}

.toast.error {
  background: var(--red);
  color: #fff;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Groups, topic management and invite page */

.permissions-body .check-row {
  color: var(--text);
}

.invite-link-row {
  display: flex;
  gap: 6px;
}

.invite-link-row .ghost-btn {
  flex: 0 0 auto;
  background: var(--panel);
}

.invite-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--rail);
}

.invite-card {
  width: min(440px, 100%);
  padding: 32px;
  border-radius: 8px;
  background: var(--chat);
  box-shadow: var(--shadow);
  text-align: center;
}

.invite-avatar {
  display: inline-flex;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent);
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
}

.invite-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.invite-kicker {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.invite-card h1 {
  margin: 6px 0 8px;
  color: var(--strong);
  font-size: 24px;
}

.invite-description {
  margin: 0 0 14px;
  color: var(--text);
}

.invite-meta {
  color: var(--muted);
  font-size: 13px;
}

.invite-join {
  width: 100%;
  margin-top: 18px;
}

.invite-home {
  display: inline-block;
  margin-top: 12px;
  color: var(--accent);
}

/* Call overlay */

.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: var(--panel);
}

.call-overlay.hidden {
  display: none;
}

.call-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0 12px 12px;
  background: var(--panel);
}
.call-minimize {
  margin-left: auto;
}

.call-return-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 75;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.call-return-btn.hidden {
  display: none;
}

.call-return-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.call-head {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 56px;
  flex: 0 0 auto;
}

.call-heading {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.call-heading strong {
  color: var(--strong);
  font-size: 16px;
}

.call-heading span {
  font-size: 13px;
}

.call-timer {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

.call-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}

.call-screen {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: var(--panel);
}

.call-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  flex: 0 0 auto;
  max-height: 46%;
}

.call-stage:not(:has(.call-screen:not(.hidden))) .call-tiles {
  flex: 1;
  max-height: none;
}

.call-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  min-height: 0;
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.call-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.call-tile.focused {
  box-shadow: 0 0 0 2px var(--accent);
  grid-column: span 2;
  min-height: 200px;
}

.tile-fullscreen-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s ease;
  cursor: pointer;
}

.tile-volume {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.call-tile:hover .tile-volume,
.call-tile.focused .tile-volume {
  opacity: 1;
}

.tile-volume-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  padding: 0;
}

.tile-volume-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.tile-volume input[type="range"] {
  width: 80px;
  accent-color: var(--accent);
}

.tile-volume span {
  min-width: 30px;
  text-align: center;
  font-size: 11px;
  color: #fff;
}

.call-tile:hover .tile-fullscreen-btn,
.call-tile.focused .tile-fullscreen-btn {
  opacity: 1;
}

.tile-fullscreen-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.call-tile.focused .call-tile-name {
  color: var(--strong);
}

.call-tile.speaking {
  box-shadow: 0 0 0 2px var(--green);
}

.call-tile-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--panel);
}

#call-remote-video,
#call-local-video {
  object-fit: contain;
}

.call-tile-share {
  grid-column: span 1;
}

.call-tile-name {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
}

.call-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
}

.call-placeholder strong {
  color: var(--strong);
  font-size: 18px;
}

.call-avatar {
  width: 96px;
  height: 96px;
  font-size: 32px;
}

.call-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.call-stage audio {
  display: none;
}

.call-incoming-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
}

.call-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0 4px;
  flex: 0 0 auto;
}

.call-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--panel);
  color: var(--strong);
  overflow: hidden;
  transition: background 0.15s ease, color 0.15s ease;
}

.call-control:hover:not(:disabled) {
  background: var(--active);
}

.call-control:disabled {
  opacity: 0.4;
}

.call-control svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.call-control.off {
  background: var(--strong);
  color: var(--rail);
}

.call-control.off::after {
  content: "";
  position: absolute;
  left: 22%;
  top: 50%;
  width: 56%;
  height: 2px;
  background: var(--red);
  transform: rotate(-45deg);
}

.call-control.active {
  background: var(--accent);
  color: #fff;
}

.call-control.end {
  width: 64px;
  border-radius: 24px;
  background: var(--red);
  color: #fff;
}

.call-volume-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  height: 52px;
  border-radius: 26px;
  background: var(--panel);
}

.call-volume-inline input[type="range"] {
  width: 96px;
  accent-color: var(--accent);
}

.call-volume-inline span {
  min-width: 34px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.call-control.end:hover {
  filter: brightness(1.1);
}

.call-settings {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: grid;
  gap: 12px;
  width: min(420px, 92vw);
  padding: 16px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.call-volume-field {
  gap: 6px;
}

.call-volume-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.call-volume-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

/* Image lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(0, 0, 0, 0.9);
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
}

body.lightbox-open {
  overflow: hidden;
}

/* Responsive layout */

@media (max-width: 1100px) {
  .app,
  .app.members-hidden {
    grid-template-columns: 72px 240px minmax(0, 1fr);
  }

  .members-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: 260px;
    box-shadow: var(--shadow);
  }
}

@media (max-width: 760px) {
  .app,
  .app.members-hidden {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 64px;
    right: 0;
    z-index: 20;
  }

  .app.chat-open .sidebar {
    display: none;
  }

  .back-btn {
    display: inline-flex;
  }

  .chat-header {
    padding-left: 4px;
  }

  .composer {
    margin: 0 8px 12px;
  }

  .msg-row {
    gap: 10px;
    padding: 2px 10px;
  }

  .msg-avatar-col {
    flex-basis: 36px;
    width: 36px;
  }

  .msg-avatar {
    width: 36px;
    height: 36px;
  }

  .call-tiles {
    grid-template-columns: 1fr;
  }

  .theme-colors {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .server-btn {
    width: 40px;
    height: 40px;
  }

  .server-rail {
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Sidebar: categories, channels, threads */

.list-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 4px;
}

.list-label-action {
  width: 22px;
  height: 22px;
  margin-top: 8px;
}

.list-label-action svg {
  width: 16px;
  height: 16px;
}

.category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin: 14px 0 4px;
  padding: 0 4px 0 2px;
  min-height: 22px;
}

.category-title {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.category-actions,
.thread-label .thread-action,
.channel-gear {
  opacity: 0;
  transition: opacity 0.12s ease;
}

.category-row:hover .category-actions,
.channel-wrap:hover .channel-gear,
.thread-label:hover .thread-action {
  opacity: 1;
}

.category-actions {
  display: flex;
  gap: 2px;
}

.channel-action,
.thread-action {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  color: var(--muted);
}

.channel-action svg,
.thread-action svg {
  width: 14px;
  height: 14px;
}

.channel-wrap {
  position: relative;
}

.channel-chip {
  height: 30px;
  padding-right: 28px;
}

.channel-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: currentColor;
  opacity: 0.8;
}

.channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-badge {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-left: auto;
  fill: currentColor;
  opacity: 0.6;
}

.channel-gear {
  position: absolute;
  top: 5px;
  right: 4px;
  width: 22px;
  height: 22px;
  color: var(--muted);
}

.channel-gear svg {
  width: 14px;
  height: 14px;
}

.thread-block {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 6px 14px;
  padding-left: 8px;
  border-left: 2px solid var(--border);
}

.thread-label {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 22px;
  padding-right: 2px;
}

.thread-label-text {
  flex: 1;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.thread-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 26px;
  padding: 0 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--faint);
  font-size: 13px;
  text-align: left;
}

.thread-item:hover {
  background: var(--hover);
  color: var(--text);
}

.thread-item.active {
  background: var(--accent-soft);
  color: var(--strong);
}

.thread-item.closed {
  opacity: 0.55;
  text-decoration: line-through;
}

.thread-icon {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  fill: currentColor;
  opacity: 0.8;
}

.thread-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-form {
  display: flex;
  gap: 4px;
  margin: 2px 0 4px;
}

.voice-roster {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 6px 14px;
  padding-left: 8px;
  border-left: 2px solid var(--border);
}

.voice-roster-user {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 26px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.voice-roster-avatar {
  width: 20px;
  height: 20px;
  font-size: 9px;
}

.voice-roster-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Voice connection bar and stage */

.voice-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px 6px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.voice-bar-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.voice-bar-info strong {
  color: var(--green);
  font-size: 13px;
}

.voice-bar-info span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-bar .icon-btn.off {
  color: var(--red);
}

.voice-bar .icon-btn.voice-leave:hover {
  color: var(--red);
}

.voice-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  overflow-y: auto;
}

.voice-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.voice-stage-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.voice-stage-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.voice-stage-title strong {
  color: var(--strong);
  font-size: 16px;
}

.voice-stage-actions {
  display: flex;
  gap: 8px;
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  align-content: start;
}

.voice-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 150px;
  padding: 16px;
  border-radius: 8px;
  background: var(--panel);
}

.voice-tile-avatar {
  width: 64px;
  height: 64px;
  font-size: 22px;
}

.voice-tile-name {
  max-width: 100%;
  overflow: hidden;
  color: var(--strong);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-tile-you {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--strong);
  font-size: 11px;
  font-weight: 600;
}

#voice-audio {
  display: none;
}

/* Modal footer helpers */

.modal-foot-spacer {
  flex: 1;
}

.modal-foot .danger-btn.small {
  min-height: 30px;
  padding: 0 12px;
  font-size: 13px;
}

/* Server settings page */

.settings-modal {
  padding: 0;
  background: var(--chat);
  backdrop-filter: none;
}

.settings-page {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 260px;
  flex: 0 0 auto;
  padding: 60px 8px 16px 20px;
  background: var(--panel);
  overflow-y: auto;
}

.settings-nav-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.settings-nav-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.settings-nav-head strong {
  overflow: hidden;
  color: var(--strong);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-tabs .modal-tab {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}

.settings-tabs .modal-tab:hover {
  background: var(--hover);
  color: var(--text);
}

.settings-tabs .modal-tab.active {
  background: var(--active);
  color: var(--strong);
  border-bottom: 0;
}

.settings-main {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

.settings-content {
  width: 100%;
  max-width: 740px;
  margin: 0;
  padding: 60px 40px 40px;
  gap: 18px;
}

.settings-close {
  position: absolute;
  top: 56px;
  right: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--muted);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.settings-close svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.settings-close span {
  position: absolute;
  top: 42px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.settings-close:hover {
  background: var(--hover);
  color: var(--strong);
}

.settings-error {
  padding: 0 40px 24px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.settings-section-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 6px;
  background: var(--panel);
}

.settings-row-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: var(--muted);
}

.settings-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.settings-row-info strong {
  color: var(--strong);
  font-weight: 600;
}

.settings-row-info span {
  font-size: 12px;
}

.settings-empty {
  margin: 0;
  padding: 6px 2px;
  font-size: 13px;
}

/* Thread manager */

#topics-modal .modal-card {
  width: min(660px, 100%);
}

#topics-modal .topic-manage-row {
  grid-template-columns: 52px minmax(0, 1fr) auto auto auto;
}

#topics-modal .topic-manage-emoji {
  text-align: center;
}

/* DM-only layout */

.app {
  grid-template-columns: 240px minmax(0, 1fr) auto;
}

.app.members-hidden {
  grid-template-columns: 240px minmax(0, 1fr);
}

@media (max-width: 1100px) {
  .app,
  .app.members-hidden {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .app,
  .app.members-hidden {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    left: 0;
  }
}

#group-bars,
#create-channel-btn,
#voice-bar,
#voice-stage {
  display: none !important;
}

/* Captcha */

.captcha-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.captcha-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.captcha-row img {
  width: 170px;
  height: 58px;
  border-radius: 6px;
  background: #eef2f5;
}

.captcha-field input {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 3px;
  background: var(--input);
  color: var(--strong);
  font-size: 18px;
  letter-spacing: 6px;
  outline: none;
  text-transform: uppercase;
}

.captcha-field input:focus {
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* Group DM picker */

.group-dm-card {
  width: min(500px, 100%);
}

.group-dm-card .field em {
  color: var(--faint);
  font-style: normal;
  font-weight: 400;
  text-transform: none;
}

.group-dm-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 2px;
}

.group-dm-user {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.group-dm-user:hover {
  background: var(--hover);
}

.group-dm-user.selected {
  background: var(--accent-soft);
  color: var(--strong);
}

.group-dm-user .avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.group-dm-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.group-dm-user-info strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-dm-user-info span {
  color: var(--muted);
  font-size: 12px;
}

.group-dm-check {
  width: 16px;
  height: 16px;
  border: 2px solid var(--muted);
  border-radius: 50%;
}

.group-dm-user.selected .group-dm-check {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--panel);
}

.group-dm-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.group-dm-selected:empty {
  display: none;
}

.group-dm-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 8px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--strong);
  font-size: 13px;
}

.group-dm-chip button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--hover);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.group-dm-chip button:hover {
  color: var(--red);
}

.group-dm-empty {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
}

.chat-item.group-dm .chat-list-avatar {
  border-radius: 8px;
}

/* Media download controls */

.bubble-media {
  position: relative;
  display: inline-flex;
  max-width: min(440px, 100%);
  margin-top: 6px;
}

.bubble-media .bubble-image {
  display: block;
  border-radius: 6px;
  object-fit: cover;
}

.media-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.media-download svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.bubble-media > .media-download {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0.92;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  transition: opacity 0.12s ease;
}

.bubble-media:hover > .media-download,
.bubble-media:focus-within > .media-download {
  opacity: 1;
}

.bubble-audio {
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.bubble-audio audio {
  max-width: 300px;
}

.bubble-audio > .media-download {
  opacity: 1;
  background: var(--panel);
  color: var(--text);
}

.bubble-video {
  display: block;
  max-width: min(440px, 100%);
  border-radius: 6px;
}

.bubble-file .media-download-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  fill: currentColor;
}

.lightbox-download {
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.lightbox-download svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.lightbox-download:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* Settings modal (Discord-like sections) */

.settings-shell {
  width: min(860px, 96vw);
  height: min(620px, 90vh);
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  overflow: hidden;
}

.settings-sidebar {
  background: var(--rail);
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--rail);
}

.settings-sidebar-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px 10px;
}

.settings-nav-btn {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 14px;
  font-weight: 500;
}

.settings-nav-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.settings-nav-btn.active {
  background: var(--accent-soft);
  color: var(--strong);
}

.settings-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--panel);
}

.settings-body {
  min-height: 0;
}

.settings-content-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rail);
}

.settings-content .settings-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.settings-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--rail);
}

.settings-foot.hidden {
  display: none;
}

.settings-account-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--chat);
  margin-bottom: 18px;
}

.settings-avatar {
  width: 56px;
  height: 56px;
  font-size: 20px;
}

.settings-account-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-account-info strong {
  color: var(--strong);
  font-size: 16px;
}

.settings-account-info span {
  color: var(--muted);
  font-size: 13px;
}

.turbo-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: fit-content;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rail);
  color: var(--text);
  font-size: 14px;
}

.settings-toggle select {
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--input);
  color: var(--strong);
}

.settings-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Profile frames */

.frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.frame-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 6px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--chat);
  color: var(--text);
}

.frame-option:hover {
  background: var(--hover);
}

.frame-option.selected {
  border-color: var(--accent);
}

.frame-option.locked {
  opacity: 0.5;
}

.frame-preview {
  width: 48px;
  height: 48px;
  font-size: 16px;
}

.frame-option-label {
  font-size: 12px;
  color: var(--muted);
}

/* Avatar frames (drawn via border + glow) */

.avatar.frame-silver {
  box-shadow: 0 0 0 3px #b8c0cc, 0 0 0 5px rgba(0, 0, 0, 0.35);
}

.avatar.frame-gold {
  box-shadow: 0 0 0 3px #f5c542, 0 0 0 5px rgba(0, 0, 0, 0.35),
    0 0 12px rgba(245, 197, 66, 0.6);
}

.avatar.frame-neon {
  box-shadow: 0 0 0 3px #22d3ee, 0 0 0 5px rgba(0, 0, 0, 0.35),
    0 0 14px rgba(34, 211, 238, 0.7);
}

.avatar.frame-rainbow {
  background: linear-gradient(135deg, #ff5f6d, #ffc371, #47e6a1, #38bdf8, #a78bfa);
  padding: 3px;
}

.avatar.frame-rainbow img,
.avatar.frame-rainbow {
  background-clip: padding-box;
}

.avatar.frame-rainbow::before {
  content: "";
}

.avatar.turbo-avatar::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px dashed rgba(245, 197, 66, 0.7);
  pointer-events: none;
}

/* Turbo card */

.turbo-card {
  padding: 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(236, 72, 153, 0.12));
  border: 1px solid var(--rail);
}

.turbo-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.turbo-logo {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.turbo-status {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.turbo-status.active {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: #fff;
}

/* Visual refresh: own identity (teal + coral), larger touch targets */

body {
  font-size: 18px;
}

.icon-btn {
  width: 34px;
  height: 34px;
}

.primary-btn,
.ghost-btn {
  height: 38px;
  padding: 0 18px;
  font-size: 16px;
  border-radius: 8px;
}

.sidebar-header {
  height: 54px;
}

.chat-header {
  height: 54px;
}

.composer {
  padding: 10px 14px;
  border-radius: 10px;
}

.message-input {
  font-size: 17px;
  line-height: 1.55;
}

.chat-item {
  padding: 10px 12px;
  gap: 12px;
}

.avatar {
  border-radius: 2px;
}

.settings-card {
  border-radius: 2px;
}

@media (max-width: 760px) {
  .settings-shell {
    grid-template-columns: 1fr;
    height: auto;
    max-height: 90vh;
  }
  .settings-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--rail);
    padding: 10px;
  }
  .settings-sidebar-title {
    width: 100%;
  }
  .settings-nav-btn {
    width: auto;
    flex: 1 1 auto;
  }
}

/* Avatar */

.avatar {
  border-radius: 18px;
  overflow: hidden;
  font-family: inherit;
}

.avatar-frame-img {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
}

.avatar img {
  position: relative;
  z-index: 1;
}

.frame-preview {
  position: relative;
  overflow: visible;
}

/* Spacing: avoid cramped UI */

.sidebar-actions {
  gap: 8px !important;
}

.chat-header-actions {
  gap: 8px !important;
}

.chat-item {
  gap: 12px;
  margin-bottom: 2px;
}

.msg-row {
  gap: 10px;
  margin-bottom: 4px;
}

.settings-toggle {
  gap: 20px;
  margin-bottom: 12px;
}

.field {
  gap: 8px;
  margin-bottom: 16px;
}

.modal-body {
  gap: 20px;
  padding-bottom: 20px;
}

.group-dm-results {
  gap: 6px;
  margin-top: 8px;
}

.members-list {
  gap: 4px;
}

.panel-member {
  gap: 10px;
  margin-bottom: 2px;
}

.sidebar-header {
  gap: 8px;
}

.composer {
  gap: 10px;
}

/* Extra bottom spacing (content not glued to footer) */

.modal-card {
  padding-bottom: 8px;
}

.settings-content .settings-body {
  padding-bottom: 12px;
}

.message-list {
  padding-bottom: 8px;
}

.sidebar {
  padding-bottom: 8px;
}

/* ==========================================================================
   Talkie â€” calm interface
   Warm charcoal and amber, system typography, flat surfaces. No glow, no
   grid, no decorative telemetry. Message actions live in one small menu that
   opens from the leading reply button, a right-click, or a touch gesture.
   ========================================================================== */

:root {
  --accent: #4f7cff;
  --chat: #05060a;
  --panel: #0d1017;
  --text: #d6dbe6;
  --strong: #f2f5fa;
  --shade: 14%;
  --green: #3ecf8e;
  --red: #f87171;
  --warn: #f59e0b;
  --on-accent: #ffffff;
  --radius: 8px;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  --border: rgba(100, 116, 139, 0.22);
  --rail: #030407;
  --input: #11151d;
  --hover: rgba(148, 163, 184, 0.08);
  --active: rgba(79, 124, 255, 0.16);
  --chat-hover: rgba(148, 163, 184, 0.04);
  --card: #0f1219;
  --muted: #9aa3b2;
  --faint: #5b6472;
  --accent-hover: #6b93ff;
  --accent-soft: rgba(79, 124, 255, 0.16);
  --danger-soft: rgba(248, 113, 113, 0.14);
  --audio-accent: #4f7cff;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  color-scheme: dark;
}

[data-theme="light"] {
  --chat: #f5f7fb;
  --panel: #eef1f7;
  --text: #1f2937;
  --strong: #0f172a;
  --shade: 5%;
  --green: #16a34a;
  --red: #dc2626;
  --warn: #d97706;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --on-accent: #ffffff;
  --radius: 8px;
  --shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
  --border: rgba(30, 41, 59, 0.12);
  --rail: #e8ecf4;
  --input: #eef1f7;
  --hover: rgba(30, 41, 59, 0.05);
  --active: rgba(37, 99, 235, 0.12);
  --chat-hover: rgba(30, 41, 59, 0.03);
  --card: #ffffff;
  --muted: #475569;
  --faint: #94a3b8;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --danger-soft: rgba(220, 38, 38, 0.1);
  --audio-accent: #2563eb;
  color-scheme: light;
}

/* --- base --------------------------------------------------------------- */

body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  background: var(--chat);
  color: var(--text);
}

h1,
h2,
h3,
h4,
strong {
  letter-spacing: -0.01em;
}

button,
input,
textarea,
select {
  border-radius: 8px;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
  background-color: color-mix(in srgb, var(--text) 24%, transparent);
}

.primary-btn,
.ghost-btn,
.danger-btn {
  min-height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 550;
  letter-spacing: 0;
  text-transform: none;
}

.primary-btn {
  background: var(--accent);
  color: var(--on-accent);
}

.primary-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.ghost-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.ghost-btn:hover {
  background: var(--hover);
  color: var(--strong);
}

.danger-btn {
  background: color-mix(in srgb, var(--red) 16%, transparent);
  color: var(--red);
}

.danger-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--red) 24%, transparent);
}

.ghost-btn.small,
.danger-btn.small,
.primary-btn.small {
  min-height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
}

.icon-btn {
  border-radius: 8px;
  color: var(--muted);
}

.icon-btn:hover:not(:disabled) {
  background: var(--hover);
  color: var(--strong);
}

.field > span,
.color-field > span,
.captcha-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.field input,
.field select,
.field textarea,
.link-row input,
.invite-link-row input,
.readonly-value {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input);
  color: var(--strong);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.link-row input:focus,
.invite-link-row input:focus {
  box-shadow: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}

.field-hint,
.form-error {
  font-size: 12.5px;
  line-height: 1.55;
}

/* --- shell -------------------------------------------------------------- */

.app {
  grid-template-columns: clamp(300px, 25vw, 360px) minmax(0, 1fr) auto;
  gap: 0;
  background: var(--chat);
}

.app.members-hidden {
  grid-template-columns: clamp(300px, 25vw, 360px) minmax(0, 1fr);
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
}

.chat-panel {
  background: var(--chat);
}

.members-panel {
  width: 264px;
  background: var(--panel);
  border-left: 1px solid var(--border);
}

/* --- sidebar ------------------------------------------------------------ */

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 22px 20px 16px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-copy strong {
  color: var(--strong);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brand-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-header {
  height: 44px;
  padding: 0 12px 0 18px;
  border-bottom: 0;
  box-shadow: none;
}

.sidebar-title {
  padding: 4px 2px;
  border-radius: 6px;
}

.sidebar-title strong {
  color: var(--strong);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.sidebar-header .icon-btn {
  width: 30px;
  height: 30px;
}

.sidebar-header .icon-btn svg {
  width: 18px;
  height: 18px;
}

.search-row {
  padding: 6px 12px 12px;
}

.search-box {
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: var(--rail);
  box-shadow: inset 0 0 0 1px transparent;
}

.search-box:focus-within {
  background: var(--input);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}

.search-box input {
  font-size: 13.5px;
}

.sidebar-scroll {
  padding: 0 8px 10px;
}

.list-label {
  padding: 8px 10px 6px;
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: none;
}

.list-label-row {
  min-height: 30px;
}

.chat-list {
  gap: 1px;
}

.chat-item {
  height: auto;
  min-height: 60px;
  gap: 11px;
  padding: 7px 10px;
  border-radius: 9px;
}

.chat-item:hover {
  background: var(--hover);
}

.chat-item.active {
  background: var(--active);
  box-shadow: inset 2px 0 0 var(--accent);
}

.chat-item.active .chat-item-name {
  color: var(--strong);
}

.chat-list-avatar {
  width: 40px;
  height: 40px;
  font-size: 13px;
  border-radius: 11px;
}

.chat-item-content {
  gap: 2px;
}

.chat-item-name {
  font-size: 14.5px;
  font-weight: 550;
}

.chat-item-time {
  font-size: 11px;
}

.chat-item-preview {
  font-size: 12.5px;
}

.unread-badge {
  min-width: 19px;
  height: 19px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  line-height: 19px;
}

.clear-dot {
  background: var(--warn);
}

.user-panel {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.me-avatar {
  width: 36px;
  height: 36px;
  font-size: 13px;
  border-radius: 10px;
}

.me-info strong {
  font-size: 13.5px;
}

.me-info span {
  font-size: 11.5px;
}

.sidebar-actions {
  gap: 1px;
}

.sidebar-actions .icon-btn {
  width: 30px;
  height: 30px;
}

.sidebar-actions .icon-btn svg {
  width: 17px;
  height: 17px;
}

.members-scroll {
  padding: 14px 10px;
}

/* --- chat header -------------------------------------------------------- */

.chat-header {
  height: 60px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  background: var(--chat);
}

.chat-person {
  gap: 10px;
  padding: 4px 6px;
  border-radius: 8px;
}

.chat-avatar {
  width: 34px;
  height: 34px;
  font-size: 12px;
  border-radius: 10px;
}

.chat-person-info {
  gap: 4px;
  flex-direction: column;
  align-items: flex-start;
}

.chat-person-info strong {
  font-size: 15px;
  font-weight: 600;
}

.chat-person-info span {
  font-size: 12px;
  color: var(--muted);
}

.chat-header-actions {
  gap: 2px;
}

.chat-header-actions .icon-btn {
  width: 34px;
  height: 34px;
}

.empty-state {
  gap: 6px;
}

.empty-badge {
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.empty-badge svg {
  width: 30px;
  height: 30px;
  fill: var(--accent);
}

.empty-state h2 {
  font-size: 22px;
  font-weight: 650;
}

.empty-state p {
  max-width: 380px;
  color: var(--muted);
  font-size: 14px;
}

/* --- notices ------------------------------------------------------------ */

.clear-notice,
.blocked-notice {
  margin: 12px 18px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  font-size: 13px;
}

.blocked-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.clear-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  border-color: color-mix(in srgb, var(--warn) 32%, transparent);
  background: color-mix(in srgb, var(--warn) 7%, var(--panel));
}

.clear-notice-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  color: var(--warn);
  font-size: 14px;
}

.clear-notice-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.clear-notice-actions {
  gap: 6px;
}

/* --- messages ----------------------------------------------------------- */

.message-list {
  padding: 18px 0 10px;
  background: var(--chat);
}

.message-list > .empty-list {
  margin: 16px 20px;
  padding: 28px 18px;
  border: 0;
  color: var(--faint);
  font-size: 13px;
}

.day-divider {
  margin: 20px 22px 6px;
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.day-divider span {
  padding: 0 12px;
}

.msg-row {
  --swipe-x: 0px;
  --swipe-progress: 0;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 14px;
  padding: 2px 22px 2px 14px;
  border-left: 0;
  touch-action: pan-y;
  transition: background 0.12s ease;
}

.msg-row > * {
  transition: transform 0.16s ease;
}

.msg-row.swiping > * {
  transition: none;
  transform: translateX(var(--swipe-x));
}

.msg-row:hover {
  background: var(--chat-hover);
}

.msg-row.continued {
  margin-top: 0;
  padding-top: 1px;
  padding-bottom: 1px;
}

.msg-row.highlight {
  background: var(--accent-soft);
}

.msg-avatar-col {
  flex: 0 0 36px;
  width: 36px;
  padding-top: 3px;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  margin-top: 0;
  border-radius: 10px;
  font-size: 13px;
}

.msg-row.continued .msg-avatar-col .msg-time-hover {
  width: 36px;
  font-size: 10px;
}

.msg-stack {
  gap: 3px;
}

.msg-header {
  align-items: baseline;
  gap: 8px;
  margin-bottom: 1px;
}

.msg-sender {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.msg-sender:hover {
  text-decoration: underline;
}

.msg-sender.me {
  color: var(--accent);
}

.msg-time {
  color: var(--faint);
  font-size: 11px;
}

.bubble {
  max-width: min(720px, 100%);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px 12px 12px 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
}

.msg-row.out .bubble {
  border-color: color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: 12px 4px 12px 12px;
  background: color-mix(in srgb, var(--accent) 13%, var(--panel));
}

.msg-row.out .bubble-reply {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.bubble-text {
  white-space: pre-wrap;
}

.bubble-meta {
  padding-left: 6px;
  font-size: 10.5px;
}

.bubble-reply {
  width: 100%;
  margin-bottom: 6px;
  padding: 6px 8px;
  border: 0;
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--text) 4%, transparent);
  text-align: left;
}

.bubble-reply-name {
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
}

.bubble-reply-text {
  color: var(--muted);
  font-size: 12.5px;
}

.bubble-image,
.bubble-video {
  border-radius: 8px;
}

.bubble-file {
  border-radius: 9px;
  background: color-mix(in srgb, var(--text) 4%, transparent);
}

/* leading reply rail (desktop) */

.msg-lead {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  margin-top: 18px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease, background 0.12s ease;
}

.msg-lead svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.msg-row:hover .msg-lead,
.msg-row:focus-within .msg-lead {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.msg-lead:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.msg-row.continued .msg-lead {
  margin-top: 1px;
}

.msg-lead:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

/* swipe affordance */

.msg-row::before {
  content: "â†©";
  position: absolute;
  left: 14px;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 50%;
  background: var(--panel);
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
  opacity: var(--swipe-progress);
  transform: scale(calc(0.7 + var(--swipe-progress) * 0.3));
  pointer-events: none;
}

.msg-row.swipe-ready::before {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* --- floating message menu --------------------------------------------- */

.msg-menu {
  position: fixed;
  z-index: 120;
  width: 224px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: msg-menu-in 0.12s ease-out;
}

@keyframes msg-menu-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-menu-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.msg-menu-head strong {
  overflow: hidden;
  color: var(--strong);
  font-size: 12.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-menu-head span {
  overflow: hidden;
  color: var(--faint);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-menu-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.msg-menu-item {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
}

.msg-menu-item:hover {
  background: var(--hover);
  color: var(--strong);
}

.msg-menu-item.danger {
  color: var(--red);
}

.msg-menu-item.danger:hover {
  background: var(--danger-soft);
}

.msg-menu.sheet {
  left: 10px;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  top: auto;
  width: auto;
  padding: 8px;
  border-radius: 15px;
}

.msg-menu.sheet .msg-menu-head {
  padding: 10px 12px;
}

.msg-menu.sheet .msg-menu-item {
  padding: 13px 12px;
  font-size: 14.5px;
}

/* --- composer + transfer tray ------------------------------------------ */

.transfer-tray {
  margin: 0 18px 8px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.transfer-tray.is-error {
  border-color: color-mix(in srgb, var(--red) 40%, transparent);
}

.transfer-top {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.transfer-signal {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

.transfer-tray.is-done .transfer-signal {
  background: var(--green);
}

.transfer-tray.is-error .transfer-signal {
  background: var(--red);
}

.transfer-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transfer-pct {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.transfer-bar {
  height: 4px;
  margin: 8px 0 7px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}

.transfer-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.18s linear;
}

.transfer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11.5px;
}

.transfer-cancel {
  padding: 2px 4px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--red);
  font-size: 11.5px;
}

.transfer-cancel:hover {
  text-decoration: underline;
}

.composer {
  margin: 0 18px 16px;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: none;
}

.composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: none;
}

#message-input {
  min-height: 46px;
  padding: 12px 8px;
  font-size: 14.5px;
}

.composer-btn {
  width: 38px;
  height: 46px;
  border-radius: 8px;
}

.send-btn {
  width: 40px;
  height: 40px;
  align-self: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
}

.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.send-btn:disabled {
  background: var(--input);
  color: var(--faint);
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

.reply-preview {
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  background: var(--chat-hover);
}

.attachment-preview {
  border-radius: 8px;
}

/* --- modals + settings -------------------------------------------------- */

.modal {
  background: rgba(12, 11, 10, 0.62);
  backdrop-filter: none;
}

[data-theme="light"] .modal {
  background: rgba(40, 33, 24, 0.38);
}

.modal-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.modal-head {
  padding: 20px 20px 10px;
}

.modal-head h2 {
  font-size: 19px;
  font-weight: 650;
}

.modal-body {
  padding: 10px 20px 20px;
}

.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: transparent;
}

.settings-shell {
  width: min(880px, 96vw);
  height: min(640px, 90vh);
  grid-template-columns: 196px minmax(0, 1fr);
}

.settings-sidebar {
  padding: 20px 10px;
  border-right: 1px solid var(--border);
  background: var(--rail);
}

.settings-sidebar-title {
  padding: 4px 10px 12px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.settings-nav-btn {
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
}

.settings-nav-btn.active {
  background: var(--active);
  color: var(--strong);
}

.settings-content {
  background: var(--panel);
}

.settings-content-head {
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--border);
}

.settings-content .settings-body {
  padding: 18px 22px;
}

.settings-account-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--chat);
}

.group-section-title {
  margin: 22px 0 8px;
  color: var(--strong);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.settings-body > .group-section-title:first-child,
.settings-section > .group-section-title:first-child {
  margin-top: 0;
}

.settings-toggle {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.settings-toggle em {
  display: block;
  margin-top: 1px;
  color: var(--faint);
  font-size: 11.5px;
  font-style: normal;
}

.settings-toggle select {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input);
  color: var(--strong);
  font-size: 13px;
}

.theme-card {
  gap: 6px;
  padding: 6px;
  border-width: 1px;
  border-radius: 9px;
  background: var(--chat);
}

.theme-card:hover {
  border-color: var(--border);
}

.theme-card.active {
  border-color: var(--accent);
}

.theme-card-swatch {
  height: 56px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--border);
}

.theme-card-meta {
  font-size: 11.5px;
  color: var(--faint);
}

.color-field input[type="color"] {
  border-radius: 7px;
  background: var(--input);
}

.theme-preview {
  border-radius: 9px;
}

/* switches */

.settings-toggle input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 12%, transparent);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.settings-toggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s ease, background 0.15s ease;
}

.settings-toggle input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.settings-toggle input[type="checkbox"]:checked::after {
  background: var(--on-accent);
  transform: translateX(16px);
}

/* OpSec */

.opsec-banner {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.opsec-banner strong {
  color: var(--strong);
  font-size: 13.5px;
  font-weight: 650;
}

.opsec-banner p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.opsec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px;
}

.opsec-facts {
  display: grid;
  gap: 0;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}

.opsec-facts li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.opsec-facts li:last-child {
  border-bottom: 0;
}

.opsec-facts span {
  color: var(--muted);
}

.opsec-facts strong {
  color: var(--text);
  font-weight: 550;
  text-align: right;
}

.settings-foot {
  padding: 12px 22px;
  border-top: 1px solid var(--border);
}

/* --- mutual erasure ----------------------------------------------------- */

.clear-card {
  width: min(520px, 100%);
}

.clear-card .modal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 2px 14px;
}

.clear-kicker {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--warn);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: none;
}

.clear-card .modal-head h2 {
  grid-column: 1;
  margin: 2px 0 0;
  font-size: 19px;
  line-height: 1.3;
}

.clear-card .modal-head .icon-btn {
  grid-column: 2;
  grid-row: 2;
}

.clear-target {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--chat);
}

.clear-target-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.clear-target strong {
  color: var(--strong);
  font-size: 14.5px;
  font-weight: 600;
}

.clear-target span {
  color: var(--faint);
  font-size: 12px;
}

.clear-copy {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.6;
}

.clear-list {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.clear-list li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.clear-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
}

.clear-warning {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--red) 34%, transparent);
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
}

.clear-card .modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* --- lock screen -------------------------------------------------------- */

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--chat);
}

.lock-card {
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}

.lock-card h2 {
  margin: 0 0 6px;
  color: var(--strong);
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-transform: none;
}

.lock-card > p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.lock-card form {
  display: grid;
  gap: 12px;
  text-align: left;
}

.lock-card .field {
  margin-bottom: 0;
}

.lock-card .primary-btn {
  height: 42px;
}

.lock-logout {
  width: 100%;
  margin-top: 10px;
}

/* --- auth --------------------------------------------------------------- */

.auth-screen {
  align-items: center;
  background: var(--chat);
}

.auth-glow {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand-logo {
  width: 58px;
  height: 58px;
  border-radius: 15px;
  background: var(--accent);
}

.brand-logo svg {
  width: 29px;
  height: 29px;
  fill: var(--on-accent);
}

.auth-card h1 {
  margin: 14px 0 2px;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.auth-sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

.auth-tabs {
  gap: 2px;
  padding: 3px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--rail);
}

.auth-tab {
  padding: 7px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 550;
  letter-spacing: 0;
  text-transform: none;
}

.auth-tab.active {
  background: var(--panel);
  color: var(--strong);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.auth-note {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.6;
}

/* --- toast -------------------------------------------------------------- */

.toast {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--strong);
  font-size: 13px;
  box-shadow: var(--shadow);
}

.toast.error {
  border-color: color-mix(in srgb, var(--red) 40%, transparent);
  background: color-mix(in srgb, var(--red) 16%, var(--panel));
  color: var(--strong);
}

/* --- lightbox ----------------------------------------------------------- */

.lightbox {
  background: rgba(10, 9, 8, 0.92);
}

.lightbox-close,
.lightbox-download {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

/* --- call UI ------------------------------------------------------------ */

.call-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
}

.call-head {
  border-bottom: 1px solid var(--border);
}

.call-tile {
  border-radius: 12px;
  background: var(--chat);
}

.call-control {
  background: var(--input);
  color: var(--text);
}

.call-control:hover {
  background: var(--hover);
  color: var(--strong);
}

/* --- responsive --------------------------------------------------------- */

@media (max-width: 1100px) {
  .app,
  .app.members-hidden {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .members-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: 280px;
    box-shadow: var(--shadow);
  }
}

@media (max-width: 820px) {
  body {
    font-size: 15px;
  }

  .app,
  .app.members-hidden {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0;
    z-index: 20;
    border-right: 0;
  }

  .app.chat-open .sidebar {
    display: none;
  }

  .chat-panel {
    border: 0;
  }

  .back-btn {
    display: inline-flex;
  }

  .chat-header {
    height: 58px;
    padding: 0 10px;
  }

  .chat-person {
    flex: 1;
    min-width: 0;
  }

  .chat-person-info {
    min-width: 0;
  }

  .chat-person-info strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-header-actions {
    gap: 0;
  }

  .chat-header-actions .icon-btn {
    width: 32px;
    height: 32px;
  }

  .message-list {
    padding: 14px 0 8px;
  }

  .msg-row {
    gap: 8px;
    padding: 5px 12px;
    margin-top: 10px;
  }

  .msg-row.continued {
    padding-top: 2px;
    padding-bottom: 2px;
  }

  .msg-lead {
    display: none;
  }

  .msg-avatar-col {
    flex-basis: 34px;
    width: 34px;
  }

  .msg-avatar {
    width: 34px;
    height: 34px;
  }

  .bubble {
    max-width: 100%;
    padding: 8px 11px;
    font-size: 15px;
  }

  .composer {
    margin: 0 8px 8px;
  }

  .transfer-tray {
    margin: 0 8px 8px;
  }

  .clear-notice,
  .blocked-notice {
    margin: 8px 8px 0;
    flex-wrap: wrap;
  }

  .clear-notice-actions {
    width: 100%;
  }

  .clear-notice-actions .ghost-btn {
    flex: 1;
  }

  .settings-shell {
    grid-template-columns: 1fr;
    width: min(560px, 96vw);
    height: auto;
    max-height: 92vh;
  }

  .settings-sidebar {
    flex-direction: row;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    padding: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .settings-sidebar-title {
    display: none;
  }

  .settings-nav-btn {
    width: auto;
    padding: 7px 10px;
    white-space: nowrap;
  }

  .settings-content .settings-body {
    padding: 16px;
  }

  .settings-foot {
    padding: 12px 16px;
  }

  .modal {
    padding: 14px;
  }

  .modal-card {
    max-height: calc(100vh - 28px);
  }

  .msg-menu {
    animation: none;
  }
}

@media (max-width: 520px) {
  .sidebar-brand {
    padding: 18px 16px 12px;
  }

  .brand-copy strong {
    font-size: 19px;
  }

  .chat-list-avatar {
    width: 44px;
    height: 44px;
  }

  .chat-item {
    min-height: 64px;
  }

  .chat-header {
    gap: 4px;
    padding: 0 8px;
  }

  .chat-avatar {
    width: 32px;
    height: 32px;
  }

  .chat-person-info strong {
    font-size: 14px;
  }

  .chat-person-info span {
    font-size: 11px;
  }

  .chat-header-actions .icon-btn {
    width: 30px;
    height: 30px;
  }

  .chat-header-actions .icon-btn svg {
    width: 17px;
    height: 17px;
  }

  .auth-card,
  .lock-card {
    padding: 24px 20px;
  }

  .clear-card .modal-foot {
    flex-wrap: wrap;
  }

  .clear-card .modal-foot .danger-btn,
  .clear-card .modal-foot .ghost-btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg-row > *,
  .msg-row::before,
  .msg-menu {
    transition: none !important;
    animation: none !important;
  }
}
/* --- loading screen ----------------------------------------------------- */

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background: var(--chat);
  color: var(--muted);
}

.loading-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.loading-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  opacity: 0.9;
  animation: loading-pulse 1.4s ease-in-out infinite;
}

.loading-brand strong {
  color: var(--strong);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.loading-skeleton {
  display: flex;
  gap: 18px;
  width: min(920px, 92vw);
  height: min(560px, 70vh);
}

.skel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.skel-sidebar {
  flex: 0 0 320px;
  gap: 14px;
}

.skel-chat {
  flex: 1;
  justify-content: flex-end;
  gap: 12px;
}

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

.skel-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  background: var(--input);
}

.skel-line {
  height: 11px;
  border-radius: 6px;
  background: var(--input);
}

.w20 { width: 20%; }
.w30 { width: 30%; }
.w40 { width: 40%; }
.w50 { width: 50%; }
.w60 { width: 60%; }
.w70 { width: 70%; }
.w80 { width: 80%; }

.skel-msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 60%;
}

.skel-in { align-self: flex-start; }
.skel-out { align-self: flex-end; }

.skel-line,
.skel-avatar {
  position: relative;
  overflow: hidden;
}

.skel-line::after,
.skel-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--text) 12%, transparent) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: skel-shimmer 1.6s infinite;
}

@keyframes skel-shimmer {
  100% {
    transform: translateX(100%);
  }
}

@keyframes loading-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1); }
}

@media (max-width: 820px) {
  .loading-skeleton {
    flex-direction: column;
    height: auto;
  }
  .skel-sidebar {
    flex: 0 0 auto;
    max-height: 40vh;
  }
  .skel-chat {
    min-height: 40vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skel-line::after,
  .skel-avatar::after,
  .loading-mark {
    animation: none;
  }
}

/* --- app shell polish ---------------------------------------------------- */

.sidebar-brand {
  gap: 17px;
  padding: 17px 18px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.brand-mark {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  box-shadow:
    0 10px 24px color-mix(in srgb, var(--accent) 26%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  -webkit-user-drag: none;
  user-select: none;
}

.brand-copy {
  gap: 2px;
}

.brand-copy strong {
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.brand-copy span {
  color: var(--faint);
  font-size: 11.5px;
  letter-spacing: 0.005em;
}

.sidebar-header {
  height: 46px;
  padding: 3px 10px 1px 16px;
}

.sidebar-title strong {
  font-size: 12.5px;
  font-weight: 600;
}

.search-row {
  padding: 8px 12px 10px;
}

.search-box {
  height: 36px;
  padding: 0 11px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--rail) 76%, var(--panel));
}

.search-box svg {
  width: 15px;
  height: 15px;
  opacity: 0.82;
}

.search-box input {
  font-size: 13px;
}

.sidebar-scroll {
  padding: 0 8px 8px;
}

.list-label {
  padding: 8px 10px 7px;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.chat-item {
  min-height: 58px;
  margin-bottom: 1px;
  padding: 7px 10px;
  border-radius: 10px;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

.chat-item:hover {
  background: color-mix(in srgb, var(--hover) 84%, var(--panel));
}

.chat-item.active {
  background: var(--active);
  box-shadow: inset 2px 0 0 var(--accent);
}

.chat-list-avatar {
  width: 39px;
  height: 39px;
  border-radius: 11px;
}

.chat-item-name {
  font-size: 14px;
  font-weight: 560;
}

.chat-item-preview {
  font-size: 12.5px;
}

.user-panel {
  margin: 2px 8px 8px;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 72%, var(--rail));
}

.me-avatar {
  border-radius: 10px;
}

.chat-header {
  height: 58px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--chat) 92%, var(--panel));
}

.chat-person {
  border-radius: 10px;
}

.chat-header-actions .icon-btn {
  border-radius: 9px;
}

.composer {
  margin: 0 18px 18px;
  padding: 6px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 88%, var(--chat));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 52%, transparent);
}

#message-input {
  padding: 12px 9px;
}

.empty-badge {
  border-radius: 18px;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 14%, transparent);
}

.members-scroll {
  padding: 16px 12px;
}

.sidebar-scroll,
.message-list,
.members-scroll {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--faint) 34%, transparent) transparent;
}

.sidebar-scroll::-webkit-scrollbar,
.message-list::-webkit-scrollbar,
.members-scroll::-webkit-scrollbar {
  width: 8px;
}

.sidebar-scroll::-webkit-scrollbar-thumb,
.message-list::-webkit-scrollbar-thumb,
.members-scroll::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--faint) 30%, transparent);
  background-clip: content-box;
}

@media (max-width: 760px) {
  .sidebar-brand {
    padding: 14px 16px 12px;
  }

  .brand-mark {
    width: 33px;
    height: 33px;
    border-radius: 10px;
  }

  .composer {
    margin: 0 12px 12px;
  }
}

/* Search results flow below the search field. The old absolute offset was
   measured from the sidebar top and covered the input once the brand row
   grew, so keep the list in the normal sidebar flow instead. */
.chat-list.search-results {
  position: static;
  margin-top: 2px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
