:root {
  color-scheme: dark;
  --bg: #111315;
  --rail: #15171a;
  --sidebar: #1b1e21;
  --surface: #202326;
  --surface-2: #272b2f;
  --surface-3: #30353a;
  --line: #34393e;
  --line-soft: #292d31;
  --text: #eef1f3;
  --muted: #969da4;
  --faint: #686f76;
  --accent: #24a7b5;
  --accent-strong: #36bac7;
  --accent-soft: #19383c;
  --green: #52c98b;
  --yellow: #e7b85c;
  --red: #ed6d66;
  --blue: #64a8ed;
  --shadow: 0 18px 60px rgba(0, 0, 0, .38);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

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

button:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.hidden {
  display: none !important;
}

.loading-screen,
.auth-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #14171a;
}

.loading-screen {
  align-content: center;
  gap: 12px;
  color: var(--muted);
}

.loading-screen p {
  margin: 0;
  font-size: 14px;
}

.brand-mark,
.brand-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #071719;
  font-size: 21px;
  font-weight: 800;
}

.auth-panel {
  width: min(410px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.auth-brand h1,
.auth-brand p {
  margin: 0;
}

.auth-brand h1 {
  font-size: 24px;
  line-height: 1.3;
}

.auth-brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  border-radius: 7px;
  background: var(--bg);
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented button.active {
  background: var(--surface-3);
  color: var(--text);
}

.stack-form {
  display: grid;
  gap: 18px;
}

.stack-form label,
.field {
  display: grid;
  gap: 8px;
  color: #cdd2d6;
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  padding: 10px 12px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 46px;
}

.password-field .icon-button {
  position: absolute;
  top: 3px;
  right: 3px;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.send-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 15px;
  cursor: pointer;
  font-weight: 650;
}

.primary-button,
.send-button {
  background: var(--accent);
  color: #071719;
}

.primary-button:hover,
.send-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.danger-button {
  border-color: rgba(237, 109, 102, .45);
  background: rgba(237, 109, 102, .11);
  color: #ff9c96;
}

.text-button {
  min-height: 32px;
  padding: 0 8px;
  background: transparent;
  color: var(--accent-strong);
}

.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
}

.icon-button:hover {
  background: var(--surface-3);
  color: var(--text);
}

.notice-block {
  padding: 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: #d8eef0;
  font-size: 13px;
}

.notice-block p {
  margin: 5px 0 0;
  color: #a9c9cc;
  line-height: 1.6;
}

.app-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 72px 310px minmax(0, 1fr);
  background: var(--bg);
}

.rail {
  position: relative;
  z-index: 5;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 9px;
  border-right: 1px solid var(--line-soft);
  background: var(--rail);
}

.brand-button {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  cursor: pointer;
}

.rail-main {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 14px;
}

.rail-button {
  position: relative;
  width: 100%;
  height: 54px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}

.rail-button > span {
  font-size: 21px;
  line-height: 1;
}

.rail-button small {
  font-size: 10px;
}

.rail-button:hover,
.rail-button.active {
  background: var(--surface-2);
  color: var(--text);
}

.rail-button.active::before {
  content: "";
  position: absolute;
  left: -9px;
  width: 3px;
  height: 25px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

.nav-dot {
  position: absolute;
  top: 7px;
  right: 10px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--rail);
  border-radius: 50%;
  background: var(--red);
}

.rail-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 2px solid var(--line);
  cursor: pointer;
}

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

.sidebar-header {
  height: 78px;
  flex: 0 0 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 15px 8px 18px;
}

.sidebar-header h2,
.sidebar-header p {
  margin: 0;
}

.sidebar-header h2 {
  margin-top: 2px;
  font-size: 20px;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
}

.search-wrap {
  height: 42px;
  flex: 0 0 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 14px 10px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--bg);
  color: var(--faint);
}

.search-wrap input {
  min-height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
}

.sidebar-content {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 8px 16px;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  margin: 6px 9px 3px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.conversation-item,
.contact-item,
.request-item {
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.conversation-item:hover,
.contact-item:hover,
.conversation-item.active,
.contact-item.active {
  background: var(--surface-2);
}

.item-copy {
  min-width: 0;
}

.item-copy strong,
.item-copy p {
  display: block;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-copy strong {
  font-size: 14px;
  font-weight: 650;
}

.item-copy p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.item-meta {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  color: var(--faint);
  font-size: 10px;
}

.badge {
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #071719;
  font-size: 10px;
  font-weight: 800;
}

.avatar {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  overflow: visible;
  border-radius: 50%;
  background: #3e474d;
  color: #ecf8f9;
  font-size: 15px;
  font-weight: 750;
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: cover;
}

.presence-dot {
  position: absolute;
  right: -1px;
  bottom: 0;
  width: 12px;
  height: 12px;
  border: 3px solid var(--sidebar);
  border-radius: 50%;
  background: var(--faint);
}

.presence-online .presence-dot { background: var(--green); }
.presence-busy .presence-dot { background: var(--yellow); }
.presence-dnd .presence-dot { background: var(--red); }

.group-avatar {
  border-radius: 7px;
  background: #3b5559;
}

.workspace {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}

.empty-state {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-symbol {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  margin-bottom: 15px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  font-size: 38px;
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state h2 {
  color: #cbd0d4;
  font-size: 18px;
}

.empty-state p {
  margin-top: 7px;
  font-size: 13px;
}

.chat-view {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr) auto auto auto;
}

.chat-view.drag-active::after {
  content: "松开以添加图片或文件";
  position: absolute;
  inset: 82px 18px 82px;
  z-index: 12;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 8px;
  background: rgba(17, 19, 21, .9);
  color: var(--accent-strong);
  font-size: 16px;
  pointer-events: none;
}

.chat-header {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.chat-header > .avatar {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
}

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

.chat-heading h2,
.chat-heading p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-heading h2 {
  font-size: 16px;
}

.chat-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.messages {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px clamp(18px, 4vw, 54px) 18px;
  scroll-behavior: smooth;
}

.message-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 620px);
  align-items: start;
  gap: 10px;
  margin-bottom: 17px;
}

.message-row.own {
  grid-template-columns: minmax(0, 620px) 36px;
  justify-content: end;
}

.message-row > .avatar {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  font-size: 12px;
}

.message-row.own > .avatar {
  grid-column: 2;
}

.message-wrap {
  min-width: 0;
}

.message-row.own .message-wrap {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
}

.message-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 5px 2px;
  color: var(--muted);
  font-size: 11px;
}

.message-row.own .message-author {
  justify-content: flex-end;
  margin-right: 2px;
}

.message-bubble {
  position: relative;
  width: fit-content;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-3);
  color: #f0f2f3;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-row.own .message-bubble {
  margin-left: auto;
  border-color: #286168;
  background: #1e4e54;
}

.message-bubble.recalled {
  color: var(--muted);
  font-style: italic;
}

.message-image {
  display: block;
  width: auto;
  max-width: min(420px, 100%);
  max-height: 380px;
  border-radius: 5px;
  object-fit: contain;
  cursor: zoom-in;
}

.message-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  max-width: 430px;
}
.message-gallery.count-1 { grid-template-columns: minmax(0, 1fr); }
.message-gallery .message-image {
  width: 100%;
  height: 170px;
  object-fit: cover;
}
.message-gallery.count-1 .message-image { height: auto; max-height: 380px; object-fit: contain; }

.message-file {
  width: min(360px, 100%);
  min-height: 62px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 5px;
  background: rgba(0, 0, 0, .15);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.message-caption {
  margin-top: 8px;
}

.reply-quote {
  margin-bottom: 7px;
  padding: 7px 9px;
  border-left: 3px solid var(--accent);
  background: rgba(0, 0, 0, .18);
  color: #b9c0c5;
  font-size: 12px;
  line-height: 1.4;
}

.message-actions {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity .15s ease;
}

.message-row:hover .message-actions,
.message-row:focus-within .message-actions {
  opacity: 1;
}

.message-row.own .message-actions {
  justify-content: flex-end;
}

.message-actions button {
  min-height: 26px;
  border: 0;
  border-radius: 4px;
  padding: 0 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.message-actions button:hover {
  background: var(--surface-3);
  color: var(--text);
}

.load-more {
  position: absolute;
  top: 81px;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.draft-attachments {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.draft-tile {
  position: relative;
  width: 92px;
  height: 72px;
  flex: 0 0 92px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}
.draft-tile img { width: 100%; height: 100%; object-fit: cover; }
.draft-file-icon { font-size: 22px; color: var(--accent-strong); }
.draft-name {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  padding: 3px 5px;
  background: rgba(0, 0, 0, .7);
  color: #fff;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.draft-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .75);
  color: #fff;
  cursor: pointer;
}

.reply-bar strong,
.reply-bar p {
  margin: 0;
  font-size: 11px;
}

.reply-bar strong { color: var(--accent-strong); }
.reply-bar p {
  max-width: 600px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer {
  min-height: 68px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 11px 15px 13px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.composer textarea {
  min-height: 42px;
  max-height: 130px;
  flex: 1;
  resize: none;
  background: var(--bg);
}

.composer .icon-button,
.send-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  padding: 0;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.sticker-item {
  aspect-ratio: 1;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
}
.sticker-item:hover { border-color: var(--accent); }
.sticker-item img { width: 100%; height: 100%; display: block; object-fit: contain; }

.content-view {
  height: 100%;
  overflow: auto;
  background: var(--surface);
}

.content-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
}

.content-header h2,
.content-header p {
  margin: 0;
}

.content-header h2 { font-size: 18px; }
.content-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.content-body {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.settings-section,
.admin-section,
.profile-section {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.settings-section:first-child,
.admin-section:first-child,
.profile-section:first-child {
  padding-top: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 17px;
}

.group-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.group-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
}

.group-identity .avatar {
  width: 64px;
  height: 64px;
  flex-basis: 64px;
  font-size: 20px;
}

.group-identity .avatar.clickable { cursor: pointer; }
.group-identity h3,
.group-identity p { margin: 0; }
.group-identity h3 { font-size: 17px; }
.group-identity p { margin-top: 6px; color: var(--muted); font-size: 11px; }

.drawer-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px 8px;
}

.member-grid-item {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.member-grid-item .avatar { width: 42px; height: 42px; }
.member-grid-item > span {
  width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-member-list { margin-top: 18px; }
.setting-rows { display: grid; gap: 0; }
.setting-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}

.toggle-button {
  width: 36px;
  height: 24px;
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  font-size: 22px;
}
.toggle-button.enabled { color: var(--accent); }
.drawer-danger { display: grid; gap: 10px; }

.notification-row {
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line-soft);
}

.notification-row > .avatar { width: 42px; height: 42px; flex-basis: 42px; }

.file-manager-modal { width: min(920px, 100%); }
.file-manager { min-height: 430px; }
.file-toolbar {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) minmax(180px, 300px);
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.file-toolbar input { min-height: 38px; }
.file-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}
.group-file-list { display: grid; }
.group-file-row {
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text);
  text-align: left;
}
button.group-file-row { cursor: pointer; }
.group-file-row:hover { background: var(--surface-2); }
.file-kind {
  width: 38px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: #3d4850;
  color: #d7e4e8;
  font-size: 12px;
  font-weight: 750;
}
.folder-kind { background: #275d66; color: #bfeff3; font-size: 18px; }
.file-copy { min-width: 0; }
.file-copy strong,
.file-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-copy strong { font-size: 13px; }
.file-copy small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.file-chevron { color: var(--muted); font-size: 20px; }
.inline-create-folder {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.section-heading h3,
.section-heading p {
  margin: 0;
}

.section-heading h3 {
  font-size: 15px;
}

.section-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.inline-form.password-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.app-shell.deletion-mode {
  grid-template-columns: 72px minmax(0, 1fr);
}

.profile-editor {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
}

.profile-editor .avatar {
  width: 82px;
  height: 82px;
  font-size: 24px;
  cursor: pointer;
}

.profile-fields {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 12px;
}

.profile-fields .signature-field {
  grid-column: 1 / -1;
}

.profile-signature {
  margin: 10px auto 0 !important;
  max-width: 320px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.status-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.status-label.active::before,
.status-label.online::before { background: var(--green); }
.status-label.banned::before,
.status-label.dnd::before { background: var(--red); }
.status-label.busy::before { background: var(--yellow); }

.profile-card {
  width: min(430px, 100%);
  margin: 38px auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: center;
}

.profile-card .avatar {
  width: 88px;
  height: 88px;
  margin: 0 auto 15px;
  font-size: 26px;
}

.profile-card h2,
.profile-card p {
  margin: 0;
}

.profile-card .account-number {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.profile-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 24px -26px -26px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.profile-details div {
  padding: 15px;
  background: var(--surface-2);
}

.profile-details span,
.profile-details strong {
  display: block;
}

.profile-details span {
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 11px;
}

.profile-details strong {
  font-size: 13px;
}

.empty-list {
  padding: 28px 12px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

.request-actions {
  display: flex;
  gap: 4px;
}

.request-actions button {
  min-height: 28px;
  border: 0;
  border-radius: 4px;
  padding: 0 8px;
  background: var(--surface-3);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.request-actions .accept {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 22px;
  background: rgba(7, 9, 11, .76);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 48;
  background: rgba(7, 9, 11, .48);
}

.side-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(430px, 100vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: drawer-in .18s ease-out;
}

.drawer-body {
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
}

@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.modal {
  width: min(520px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal.wide { width: min(720px, 100%); }

.modal-header {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 10px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
}

.member-list,
.check-list,
.device-list {
  display: grid;
  gap: 6px;
}

.member-row,
.check-row,
.device-row {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.member-row .avatar,
.check-row .avatar {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

.member-copy,
.device-copy {
  min-width: 0;
  flex: 1;
}

.member-copy strong,
.member-copy span,
.device-copy strong,
.device-copy span {
  display: block;
}

.member-copy span,
.device-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.member-actions {
  display: flex;
  gap: 4px;
}

.member-actions button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.crop-stage {
  position: relative;
  width: min(420px, 100%);
  aspect-ratio: 1;
  margin: 0 auto 18px;
  overflow: hidden;
  background: var(--bg);
  cursor: grab;
  touch-action: none;
}

.crop-stage:active { cursor: grabbing; }

.crop-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.crop-guide {
  position: absolute;
  inset: 7%;
  border: 2px solid rgba(255, 255, 255, .8);
  border-radius: 50%;
  box-shadow: 0 0 0 200px rgba(0, 0, 0, .46);
  pointer-events: none;
}

.crop-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.crop-controls input {
  min-height: auto;
  padding: 0;
  accent-color: var(--accent);
}

.image-preview {
  max-width: 100%;
  max-height: 58vh;
  display: block;
  margin: 0 auto 15px;
  border-radius: 6px;
  object-fit: contain;
}

.lightbox-image {
  max-width: min(1100px, 94vw);
  max-height: 90vh;
  object-fit: contain;
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  width: min(340px, calc(100vw - 36px));
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #2d3236;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  animation: toast-in .18s ease-out;
}

.toast.error {
  border-color: rgba(237, 109, 102, .55);
  color: #ffc0bc;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.deletion-gate {
  width: min(520px, calc(100% - 40px));
  margin: 8vh auto 0;
  text-align: center;
}

.deletion-gate h2 { font-size: 22px; }
.deletion-gate p {
  color: var(--muted);
  line-height: 1.7;
}

.gate-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.mobile-only { display: none; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 66px 278px minmax(0, 1fr); }
  .rail { padding-inline: 7px; }
  .rail-button.active::before { left: -7px; }
  .messages { padding-inline: 18px; }
  .content-body { padding: 22px; }
  .profile-fields { grid-template-columns: 1fr 1fr; }
  .profile-fields .primary-button { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 64px;
  }

  .rail {
    grid-row: 2;
    flex-direction: row;
    justify-content: space-around;
    gap: 0;
    padding: 5px max(6px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .brand-button,
  .rail-avatar { display: none; }
  .rail-main {
    flex: initial;
    width: auto;
    display: contents;
    padding: 0;
  }

  .rail-button {
    width: 64px;
    height: 50px;
  }

  .rail-button.active::before {
    top: -5px;
    left: 50%;
    width: 24px;
    height: 3px;
    transform: translateX(-50%);
    border-radius: 0 0 2px 2px;
  }

  .sidebar,
  .workspace {
    grid-row: 1;
    grid-column: 1;
  }

  .sidebar {
    position: relative;
    z-index: 2;
    border-right: 0;
  }

  .workspace {
    z-index: 1;
  }

  .app-shell.mobile-workspace .sidebar { display: none; }
  .app-shell.mobile-workspace .workspace { z-index: 3; }

  .mobile-only { display: grid; }
  .chat-header { padding-left: 7px; }
  .chat-header > .avatar { display: none; }
  .messages { padding: 18px 12px 12px; }
  .message-row { grid-template-columns: 32px minmax(0, 1fr); }
  .message-row.own { grid-template-columns: minmax(0, 1fr) 32px; }
  .message-row > .avatar { width: 32px; height: 32px; }
  .message-image { max-height: 280px; }
  .message-gallery .message-image { height: 130px; }
  .sticker-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .message-actions { opacity: 1; }
  .composer { padding-inline: 9px; }
  .composer .icon-button,
  .send-button { width: 40px; flex-basis: 40px; }
  .content-header { padding-inline: 16px; }
  .content-body { padding: 20px 16px 86px; }
  .profile-editor { grid-template-columns: 1fr; }
  .profile-fields,
  .inline-form { grid-template-columns: 1fr; }
  .inline-form.password-grid { grid-template-columns: 1fr; }
  .app-shell.deletion-mode {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 64px;
  }
  .file-toolbar { grid-template-columns: auto 1fr; }
  .file-toolbar input { grid-column: 1 / -1; }
  .profile-editor .avatar { margin: 0 auto; }
  .section-heading { align-items: flex-start; }
  .group-tools { justify-content: flex-start; }
  .data-table { display: block; overflow-x: auto; }
  .modal-backdrop { padding: 0; place-items: end center; }
  .modal {
    width: 100%;
    max-height: 92vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }
}

@media (max-width: 420px) {
  .auth-panel {
    padding: 24px 20px;
    border-right: 0;
    border-left: 0;
  }
  .chat-heading h2 { font-size: 14px; }
  .message-author span:first-child { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
