:root {
  color-scheme: light;
  --bg-deep: #101612;
  --bg-panel: #17231d;
  --bg-panel-2: #203129;
  --paper: #fbf7ed;
  --paper-soft: #fffdf8;
  --paper-line: rgba(51, 45, 36, 0.12);
  --ink: #1e241f;
  --ink-soft: #69746e;
  --white-soft: rgba(255, 255, 255, 0.72);
  --white-dim: rgba(255, 255, 255, 0.48);
  --jade: #24786f;
  --mint: #9ed9c9;
  --honey: #d2a04c;
  --clay: #bf6f5f;
  --sky: #58799c;
  --plum: #7d5871;
  --danger: #b74d45;
  --shadow-heavy: 0 34px 110px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 16px 42px rgba(30, 36, 31, 0.16);
  --font: "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Inter, system-ui, sans-serif;
  font-family: var(--font);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-deep: #f4f0e6;
  --bg-panel: #fffdf8;
  --bg-panel-2: #eef6f2;
  --paper: #fffdf8;
  --paper-soft: #ffffff;
  --paper-line: rgba(48, 62, 54, 0.12);
  --ink: #18201b;
  --ink-soft: #66736c;
  --white-soft: rgba(24, 32, 27, 0.68);
  --white-dim: rgba(24, 32, 27, 0.48);
  --shadow-heavy: 0 30px 90px rgba(45, 55, 48, 0.22);
  --shadow-soft: 0 14px 34px rgba(45, 55, 48, 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-deep: #0c1110;
  --bg-panel: #121b17;
  --bg-panel-2: #1a2822;
  --paper: #151d19;
  --paper-soft: #101713;
  --paper-line: rgba(255, 255, 255, 0.11);
  --ink: #f3efe7;
  --ink-soft: #a7b4ad;
  --white-soft: rgba(255, 255, 255, 0.76);
  --white-dim: rgba(255, 255, 255, 0.5);
  --shadow-heavy: 0 34px 110px rgba(0, 0, 0, 0.48);
  --shadow-soft: 0 16px 42px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body,
#app {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px 32px),
    linear-gradient(0deg, rgba(255,255,255,0.028) 1px, transparent 1px 32px),
    linear-gradient(135deg, #0e1512, #17231d 44%, #2b2218 100%);
  font-family: var(--font);
}

:root[data-theme="light"] body {
  background:
    linear-gradient(90deg, rgba(36,120,111,0.05) 1px, transparent 1px 34px),
    linear-gradient(0deg, rgba(36,120,111,0.04) 1px, transparent 1px 34px),
    linear-gradient(135deg, #f8f3e8, #edf7f2 48%, #f7edda 100%);
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px 32px),
    linear-gradient(0deg, rgba(255,255,255,0.022) 1px, transparent 1px 32px),
    linear-gradient(135deg, #080d0b, #111d18 48%, #1b1712 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

a {
  color: inherit;
  text-decoration: none;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    repeating-linear-gradient(115deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 20px),
    linear-gradient(135deg, rgba(36,120,111,0.24), transparent 40%),
    linear-gradient(315deg, rgba(210,160,76,0.22), transparent 36%);
}

.auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 430px;
  width: min(1180px, 100%);
  min-height: 680px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow-heavy);
}

.auth-story {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.08), transparent 42%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 48px),
    linear-gradient(135deg, #111b16, #22342c);
}

.brand-line,
.global-brand,
.global-user,
.chat-title,
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.16), transparent),
    linear-gradient(135deg, var(--jade), var(--sky));
  color: #fff;
  font-weight: 950;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.24), 0 18px 45px rgba(0,0,0,0.28);
}

.brand-line strong,
.global-brand strong,
.global-user strong {
  display: block;
  color: inherit;
  font-weight: 950;
}

.brand-line span,
.global-brand span,
.global-user span {
  display: block;
  margin-top: 3px;
  color: var(--white-dim);
  font-size: 12px;
}

.auth-headline {
  max-width: 720px;
}

.auth-headline > span,
.panel-kicker,
.pane-heading span {
  color: var(--mint);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.auth-headline h1 {
  margin-top: 14px;
  color: #fff;
  font-size: clamp(52px, 6vw, 88px);
  line-height: 0.95;
  letter-spacing: 0;
}

.auth-headline p {
  margin-top: 22px;
  color: var(--white-soft);
  font-size: 18px;
  line-height: 1.8;
}

.comfort-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.comfort-grid article {
  min-height: 108px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  background: rgba(255,255,255,0.08);
}

.comfort-grid strong {
  display: block;
  color: #fff;
}

.comfort-grid span {
  display: block;
  margin-top: 8px;
  color: var(--white-dim);
  font-size: 13px;
  line-height: 1.6;
}

.auth-panel {
  display: grid;
  align-content: center;
  padding: 38px;
  background: linear-gradient(180deg, var(--paper-soft), var(--paper));
}

.auth-panel h2 {
  margin: 8px 0 22px;
  color: var(--ink);
  font-size: 34px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--paper-line);
  border-radius: 16px;
  background: rgba(30,36,31,0.06);
}

.segment,
.tab {
  border: 0;
  font-weight: 950;
}

.segment {
  min-height: 42px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
}

.segment.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.auth-form,
.profile-form {
  display: grid;
  gap: 15px;
  margin-top: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 850;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--paper-line);
  border-radius: 15px;
  background: rgba(255,255,255,0.9);
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 46px;
  padding: 0 14px;
}

textarea {
  min-height: 88px;
  max-height: 180px;
  padding: 13px;
  resize: vertical;
}

input[type="color"] {
  padding: 5px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(36,120,111,0.62);
  box-shadow: 0 0 0 4px rgba(36,120,111,0.12);
}

.primary-btn,
.danger-btn,
.small-btn {
  min-height: 40px;
  border: 0;
  border-radius: 13px;
  padding: 0 14px;
  font-weight: 950;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.primary-btn {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.16), transparent),
    linear-gradient(135deg, var(--jade), #1e5960);
  color: #fff;
  box-shadow: 0 14px 30px rgba(36,120,111,0.26);
}

.primary-btn:hover,
.small-btn:hover,
.danger-btn:hover {
  transform: translateY(-1px);
}

.wide {
  width: 100%;
}

.small-btn {
  display: inline-grid;
  place-items: center;
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.small-btn.quiet {
  background: rgba(255,255,255,0.07);
  color: var(--white-soft);
}

.conversation .small-btn,
.composer .small-btn,
.profile-form .small-btn {
  background: #e8f2ed;
  color: var(--jade);
}

.danger-btn {
  background: #f8ded8;
  color: var(--danger);
}

.mobile-more-btn {
  display: inline-grid;
  min-width: 42px;
  place-items: center;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.qiyu-shell {
  display: grid;
  grid-template-rows: 78px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 12px;
  gap: 12px;
  overflow: hidden;
}

.global-bar {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.09), transparent),
    rgba(16,22,18,0.92);
  color: #fff;
  box-shadow: var(--shadow-heavy);
}

.global-center {
  display: grid;
  grid-template-columns: minmax(220px, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.command-pill {
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
}

.command-pill span {
  color: var(--white-dim);
  font-size: 12px;
}

.command-pill strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-user {
  justify-content: end;
  min-width: 0;
  max-width: none;
  overflow: hidden;
}

.global-user > div:nth-child(2) {
  flex: 0 1 230px;
  min-width: 180px;
}

.global-user strong,
.global-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-user .small-btn {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 0 11px;
}

#connectionState {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: 76px 330px minmax(0, 1fr) 310px;
  gap: 12px;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.left-rail,
.people-pane,
.conversation,
.detail-card {
  border: 1px solid rgba(255,255,255,0.13);
  box-shadow: var(--shadow-heavy);
}

.left-rail {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 12px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent),
    rgba(16,22,18,0.92);
}

.mobile-settings-logout,
.mobile-chat-menu {
  display: none;
}

.tab {
  display: grid;
  min-height: 62px;
  place-items: center;
  border-radius: 18px;
  background: transparent;
  color: var(--white-dim);
}

.tab span {
  writing-mode: vertical-rl;
  letter-spacing: 0.1em;
}

.tab.is-active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.people-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent),
    rgba(23,35,29,0.94);
  color: #fff;
}

.status-card {
  display: grid;
  grid-template-columns: 1fr 74px;
  gap: 12px;
  margin: 14px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  background: rgba(255,255,255,0.07);
}

.status-card span,
.hint-card span {
  display: block;
  color: var(--white-dim);
  font-size: 12px;
}

.status-card strong {
  display: block;
  margin-top: 5px;
  color: #fff;
}

.rain-meter {
  align-self: center;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
}

.rain-meter span {
  display: block;
  width: 72%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--honey));
}

.side-panel {
  display: none;
  min-height: 0;
  padding: 0 14px 14px;
  overflow: auto;
}

.side-panel.is-active {
  display: block;
}

.pane-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 4px 0 12px;
}

.pane-heading h2 {
  margin-top: 4px;
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.side-panel h3 {
  margin: 14px 0 10px;
  color: var(--white-dim);
  font-size: 13px;
}

.search-row {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 12px;
  background: linear-gradient(180deg, rgba(23,35,29,0.98), rgba(23,35,29,0.94) 80%, transparent);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 12px;
}

.inline-form input {
  min-width: 0;
}

.compact-heading {
  margin-top: 18px;
}

.group-manager {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.more-home,
.more-page {
  display: none;
}

.more-home.is-active,
.more-page.is-active {
  display: block;
}

.more-grid {
  display: grid;
  gap: 10px;
}

.more-card {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  background: rgba(255,255,255,0.07);
  color: #fff;
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.more-card strong {
  color: inherit;
  font-size: 16px;
}

.more-card span {
  color: var(--white-dim);
  font-size: 13px;
}

.danger-card {
  border-color: rgba(255,136,122,0.22);
}

.more-page-header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.more-page-header strong {
  color: #fff;
  font-size: 18px;
}

.more-back-btn {
  display: inline-grid;
  min-height: 36px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-weight: 950;
}

.more-card-body {
  margin-bottom: 12px;
}

.theme-choice-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.theme-choice-row .small-btn {
  min-height: 46px;
}

.theme-choice-row .small-btn.is-active {
  background: linear-gradient(135deg, var(--jade), #1e5960);
  color: #fff;
  box-shadow: 0 14px 30px rgba(36,120,111,0.22);
}

.changelog-list {
  display: grid;
  gap: 12px;
}

.changelog-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  background: rgba(255,255,255,0.07);
}

.changelog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.changelog-head strong {
  color: #fff;
  font-size: 16px;
}

.changelog-head span {
  color: var(--white-dim);
  font-size: 12px;
}

.changelog-points {
  display: grid;
  gap: 8px;
}

.changelog-points p {
  margin: 0;
  color: var(--white-soft);
  font-size: 13px;
  line-height: 1.65;
}

.group-member-tools {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.helper-text {
  margin: -4px 0 4px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.member-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.member-actions .small-btn,
.member-actions .danger-btn,
.action-group .small-btn,
.action-group .danger-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.friend-pick-list {
  max-height: 280px;
  overflow: auto;
}

.search-row input,
.side-panel input,
.side-panel textarea,
.side-panel select {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.search-row input::placeholder,
.side-panel input::placeholder,
.side-panel textarea::placeholder {
  color: rgba(255,255,255,0.42);
}

.qiyu-shell.is-menu-open .mobile-chat-menu {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 60;
  display: grid;
  width: min(520px, calc(100vw - 24px));
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--paper-line);
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-heavy);
}

.mobile-chat-menu header {
  display: grid;
  min-height: 62px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--paper-line);
  background: rgba(255,253,248,0.92);
  backdrop-filter: blur(16px);
}

.mobile-chat-menu header strong {
  color: var(--ink);
  font-size: 17px;
}

.mobile-menu-list {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding: 16px;
}

.mobile-menu-list > button {
  min-height: 54px;
  border: 1px solid var(--paper-line);
  border-radius: 16px;
  background: rgba(255,255,255,0.72);
  color: var(--ink);
  font-weight: 950;
  text-align: left;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.tab {
  position: relative;
}

.tab-label {
  position: relative;
  z-index: 1;
}

.tab-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(16,22,18,0.92);
  border-radius: 50%;
  background: #ff6a61;
  box-shadow: 0 0 0 4px rgba(255,106,97,0.14);
}

.mini-stats span,
.hint-card,
.avatar-editor {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  background: rgba(255,255,255,0.07);
}

.mini-stats span {
  padding: 12px;
  color: var(--white-dim);
}

.mini-stats strong {
  color: #fff;
  font-size: 22px;
}

.hint-card {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  padding: 14px;
}

.hint-card strong {
  color: #fff;
}

.list {
  display: grid;
  gap: 9px;
}

.compact {
  margin-bottom: 18px;
}

.person-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  width: 100%;
  min-height: 68px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  text-align: left;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.person-row:hover,
.person-row.is-active {
  border-color: rgba(158,217,201,0.48);
  background: rgba(158,217,201,0.13);
  transform: translateY(-1px);
}

.person-main {
  min-width: 0;
}

.person-main strong,
.person-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-main span,
.person-status {
  margin-top: 3px;
  color: var(--white-dim);
  font-size: 13px;
}

.badge {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--clay);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  line-height: 24px;
  text-align: center;
}

.avatar {
  position: relative;
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  background: var(--jade);
  color: #fff;
  font-weight: 950;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 12px 28px rgba(0,0,0,0.2);
}

.avatar.large {
  width: 58px;
  height: 58px;
}

.avatar.huge {
  width: 82px;
  height: 82px;
  font-size: 22px;
}

.avatar.mega {
  width: 98px;
  height: 98px;
  margin-top: -56px;
  border: 4px solid #fff;
  font-size: 24px;
}

.avatar.is-online::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 13px;
  height: 13px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #58d07e;
  box-shadow: 0 0 0 4px rgba(88,208,126,0.16);
}

.avatar-editor {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.avatar-editor span {
  display: block;
  margin-top: 8px;
  color: var(--white-dim);
  font-size: 12px;
  line-height: 1.55;
}

.conversation {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.64), transparent 18%),
    repeating-linear-gradient(0deg, rgba(30,36,31,0.025) 0 1px, transparent 1px 34px),
    var(--paper);
  box-shadow: var(--shadow-heavy);
}

.conversation-header {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--paper-line);
  background: rgba(255,253,248,0.8);
  backdrop-filter: blur(16px);
}

.chat-title {
  min-width: 0;
}

.mobile-back-btn {
  display: none;
}

.more-page .more-back-btn {
  display: inline-grid;
}

.mobile-chat-menu .mobile-back-btn {
  display: inline-grid;
  min-height: 38px;
  place-items: center;
  border: 0;
  border-radius: 13px;
  padding: 0 12px;
  background: rgba(47,111,115,0.1);
  color: var(--jade);
  font-weight: 950;
}

.chat-title > div:last-child {
  min-width: 0;
}

.chat-title strong {
  display: block;
  overflow: hidden;
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title span {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-actions > :not(.mobile-more-btn) {
  display: none;
}

.conversation-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--paper-line);
  background: rgba(255,253,248,0.72);
}

.conversation-tools span,
#charCounter {
  color: var(--ink-soft);
  font-size: 12px;
}

.messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: 100%;
  color: var(--ink-soft);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 20px;
}

.message {
  display: grid;
  width: fit-content;
  max-width: min(690px, 78%);
  gap: 6px;
  scroll-margin: 160px;
}

.message:not(.is-mine) {
  align-self: flex-start;
}

.message.is-mine {
  align-self: flex-end;
}

.message.is-mine .bubble,
.message.is-mine .time,
.message.is-mine .message-actions {
  justify-self: end;
  text-align: right;
}

.bubble {
  width: fit-content;
  max-width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(30,36,31,0.08);
  border-radius: 18px 18px 18px 7px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.is-mine .bubble {
  border-color: transparent;
  border-radius: 18px 18px 7px 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.16), transparent),
    linear-gradient(135deg, var(--jade), #1f5960);
  color: #fff;
}

.message.is-hit .bubble {
  outline: 3px solid rgba(210,160,76,0.24);
}

.message.is-flash .bubble {
  animation: messageFlash 1.1s ease;
}

@keyframes messageFlash {
  0%, 100% { outline: 0 solid rgba(210,160,76,0); }
  35% { outline: 4px solid rgba(210,160,76,0.34); }
}

.message-text {
  width: fit-content;
  max-width: 100%;
  margin: 0;
}

.reply-quote {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  border: 0;
  border-left: 3px solid rgba(47,111,115,0.42);
  border-radius: 9px;
  padding: 8px 10px;
  background: rgba(47,111,115,0.08);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.45;
  text-align: left;
}

.message.is-mine .reply-quote {
  border-left-color: rgba(255,255,255,0.58);
  background: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.86);
}

.image-bubble {
  box-sizing: border-box;
  width: min(390px, 100%);
  max-width: 100%;
  padding: 7px;
}

.image-message {
  display: grid;
  width: 100%;
  max-width: 100%;
  gap: 8px;
}

.image-message img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 450px;
  object-fit: cover;
  border-radius: 14px;
  cursor: zoom-in;
  transition: transform 160ms ease, filter 160ms ease;
}

.image-message img:hover {
  filter: saturate(1.06) contrast(1.03);
  transform: scale(1.01);
}

.image-message p {
  margin: 0;
  padding: 2px 7px 6px;
}

.sticker-bubble {
  padding: 7px;
  background: rgba(255,255,255,0.68);
}

.message.is-mine .sticker-bubble {
  background: rgba(47,111,115,0.12);
}

.sticker-message {
  display: grid;
  place-items: center;
}

.sticker-message img {
  display: block;
  width: auto;
  max-width: min(150px, 44vw);
  max-height: 150px;
  object-fit: contain;
  border-radius: 15px;
  cursor: pointer;
}

.sticker-emoji {
  display: block;
  min-width: 44px;
  padding: 2px 4px;
  font-size: 42px;
  line-height: 1.1;
  text-align: center;
}

.image-placeholder {
  display: grid;
  gap: 6px;
  width: min(330px, 64vw);
  min-height: 168px;
  align-content: center;
  padding: 18px;
  border: 1px dashed rgba(36,120,111,0.42);
  border-radius: 14px;
  background:
    repeating-linear-gradient(135deg, rgba(36,120,111,0.08) 0 8px, rgba(88,121,156,0.08) 8px 16px),
    #f7fbf8;
  color: var(--jade);
}

.message.is-mine .image-placeholder {
  border-color: rgba(255,255,255,0.52);
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.image-placeholder span {
  color: inherit;
  font-size: 13px;
  opacity: 0.82;
}

.time {
  color: var(--ink-soft);
  font-size: 12px;
}

.message.is-mine .time {
  text-align: right;
}

.message-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 140ms ease;
}

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

.message.is-mine .message-actions {
  justify-content: flex-end;
}

.message-actions button {
  min-height: 26px;
  border: 1px solid rgba(30,36,31,0.08);
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(255,255,255,0.72);
  color: var(--jade);
  font-size: 12px;
  font-weight: 900;
}

.quick-replies {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
}

.quick-replies button {
  min-height: 36px;
  border: 1px solid rgba(30,36,31,0.1);
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(255,255,255,0.68);
  color: var(--jade);
  font-weight: 950;
}

.composer {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  min-width: 0;
  padding: 14px;
  border-top: 1px solid var(--paper-line);
  background: rgba(255,253,248,0.82);
  backdrop-filter: blur(16px);
}

.composer > * {
  min-width: 0;
}

.composer textarea {
  min-height: 46px;
  max-height: 150px;
  resize: none;
  overflow-y: auto;
}

.reply-preview {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(47,111,115,0.12);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(158,217,201,0.18), rgba(255,255,255,0.52)),
    #fff;
}

.pending-image-preview {
  grid-column: 1 / -1;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 9px;
  border: 1px solid rgba(47,111,115,0.14);
  border-radius: 16px;
  background: rgba(255,255,255,0.74);
  box-shadow: 0 10px 24px rgba(30,36,31,0.08);
}

.composer-plus-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  max-height: min(430px, 48vh);
  overflow: hidden;
  padding: 12px;
  border: 1px solid rgba(47,111,115,0.12);
  border-radius: 18px;
  background: rgba(255,255,255,0.76);
  box-shadow: 0 10px 24px rgba(30,36,31,0.08);
}

.composer-plus-panel[data-mode="emoji"] {
  grid-template-rows: auto minmax(0, 1fr);
}

.composer-plus-panel[data-mode="emoji"] .composer-action-grid {
  display: none;
}

.composer-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.composer-panel-head strong {
  color: var(--ink);
  font-size: 14px;
}

.composer-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.composer-action-card {
  display: grid;
  gap: 4px;
  min-height: 84px;
  align-content: center;
  border: 1px solid rgba(47,111,115,0.12);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,0.9);
  color: var(--ink);
  text-align: left;
}

.composer-action-card strong {
  font-size: 14px;
}

.composer-action-card span {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}

.emoji-sticker-panel {
  display: grid;
  gap: 14px;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.emoji-panel-tabs {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-bottom: 2px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(10px);
}

.emoji-section {
  display: grid;
  gap: 10px;
}

.emoji-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.emoji-section-head strong {
  color: var(--ink);
  font-size: 14px;
}

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

.emoji-chip {
  min-height: 46px;
  border: 1px solid rgba(47,111,115,0.12);
  border-radius: 14px;
  background: rgba(255,255,255,0.92);
  font-size: 24px;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  min-height: 0;
}

.sticker-item {
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 1px solid rgba(47,111,115,0.12);
  border-radius: 16px;
  padding: 6px;
  background: rgba(255,255,255,0.92);
}

.sticker-item img {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border-radius: 12px;
}

.pending-image-list {
  display: flex;
  max-width: 100%;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  overscroll-behavior-x: contain;
}

.pending-image-item {
  position: relative;
  display: grid;
  flex: 0 0 126px;
  grid-template-rows: 82px auto;
  gap: 7px;
  padding: 7px;
  border: 1px solid rgba(47,111,115,0.12);
  border-radius: 14px;
  background: rgba(255,255,255,0.72);
}

.pending-image-item img {
  width: 58px;
  width: 100%;
  height: 82px;
  border-radius: 12px;
  object-fit: cover;
}

.pending-image-item strong,
.pending-image-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-image-item strong {
  color: var(--ink);
  font-size: 13px;
}

.pending-image-item span {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12px;
}

.pending-image-item button {
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 30px;
  min-height: 30px;
  border-radius: 999px;
  padding: 0;
}

.reply-preview strong,
.reply-preview span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-preview strong {
  color: var(--jade);
  font-size: 13px;
}

.reply-preview span {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 12px;
}

.composer-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

#charCounter {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#charCounter:not(:empty) {
  display: block;
}

.composer-actions .small-btn,
.composer-actions .primary-btn {
  flex: 0 0 auto;
  min-width: 72px;
}

.composer-actions .primary-btn {
  margin-left: auto;
}

.detail-rail {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

.detail-card {
  padding: 18px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(251,247,237,0.92)),
    var(--paper);
}

.detail-card h2 {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-preview {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 14px 0 8px;
  text-align: center;
}

.profile-preview span {
  color: var(--ink-soft);
  font-size: 13px;
}

.facts {
  display: grid;
  gap: 8px;
}

.facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--paper-line);
}

.facts dt {
  color: var(--ink-soft);
}

.facts dd {
  margin: 0;
  max-width: 160px;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announcement-list {
  display: grid;
  gap: 9px;
}

.announcement-item {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--paper-line);
  border-radius: 16px;
  background: #fff;
}

.announcement-item strong {
  color: var(--jade);
}

.announcement-item span {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8,14,12,0.66);
  backdrop-filter: blur(20px);
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 26px;
  background: rgba(8,14,12,0.78);
  backdrop-filter: blur(24px);
}

.image-viewer img {
  max-width: min(1120px, 94vw);
  max-height: 88vh;
  border-radius: 18px;
  object-fit: contain;
  box-shadow: 0 30px 90px rgba(0,0,0,0.42);
}

.viewer-close {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2;
  min-height: 40px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  padding: 0 14px;
  background: rgba(255,255,255,0.9);
  color: var(--jade);
  font-weight: 950;
}

.profile-dialog {
  position: relative;
  width: min(480px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow-heavy);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  min-height: 36px;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  background: rgba(255,255,255,0.86);
  color: var(--jade);
  font-weight: 950;
}

.profile-cover {
  height: 148px;
  background:
    repeating-linear-gradient(120deg, rgba(255,255,255,0.1) 0 1px, transparent 1px 18px),
    linear-gradient(135deg, var(--jade), var(--sky) 54%, var(--honey));
}

.profile-body {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0 28px 28px;
  text-align: center;
}

.profile-body > strong {
  font-size: 24px;
}

.profile-body > span,
.profile-body > p {
  margin: 0;
  color: var(--ink-soft);
}

.profile-facts {
  display: grid;
  width: 100%;
  gap: 8px;
  margin: 15px 0 0;
}

.profile-facts div {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--paper-line);
  text-align: left;
}

.profile-facts dt {
  color: var(--ink-soft);
}

.profile-facts dd {
  margin: 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 36px));
  padding: 13px 15px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 16px;
  background: #101612;
  color: #fff;
  box-shadow: var(--shadow-heavy);
}

:root[data-theme="light"] .global-bar,
:root[data-theme="light"] .left-rail,
:root[data-theme="light"] .people-pane {
  border-color: rgba(36,120,111,0.12);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.82), rgba(255,255,255,0.52)),
    rgba(255,253,248,0.88);
  color: var(--ink);
}

:root[data-theme="light"] .status-card,
:root[data-theme="light"] .mini-stats span,
:root[data-theme="light"] .hint-card,
:root[data-theme="light"] .avatar-editor,
:root[data-theme="light"] .person-row {
  border-color: rgba(36,120,111,0.12);
  background: rgba(255,255,255,0.72);
  color: var(--ink);
}

:root[data-theme="light"] .pane-heading h2,
:root[data-theme="light"] .status-card strong,
:root[data-theme="light"] .hint-card strong,
:root[data-theme="light"] .mini-stats strong,
:root[data-theme="light"] .person-main strong {
  color: var(--ink);
}

:root[data-theme="light"] .search-row {
  background: linear-gradient(180deg, rgba(255,253,248,0.98), rgba(255,253,248,0.9) 80%, transparent);
}

:root[data-theme="light"] .search-row input,
:root[data-theme="light"] .side-panel input,
:root[data-theme="light"] .side-panel textarea,
:root[data-theme="light"] .side-panel select {
  border-color: rgba(36,120,111,0.13);
  background: rgba(255,255,255,0.84);
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
}

:root[data-theme="light"] .inline-form input {
  border-color: rgba(36,120,111,0.2);
  background: #fff;
  color: #18201b;
  -webkit-text-fill-color: #18201b;
}

:root[data-theme="light"] .inline-form input::placeholder {
  color: rgba(24,32,27,0.56);
  -webkit-text-fill-color: rgba(24,32,27,0.56);
}

:root[data-theme="light"] .inline-form .small-btn {
  background: var(--jade);
  color: #fff;
}

:root[data-theme="light"] .small-btn,
:root[data-theme="light"] .conversation .small-btn,
:root[data-theme="light"] .composer .small-btn,
:root[data-theme="light"] .profile-form .small-btn {
  border: 1px solid rgba(36,120,111,0.18);
  background: #e8f2ed;
  color: var(--jade);
}

:root[data-theme="light"] .small-btn.quiet {
  background: #f5faf7;
  color: #2f6f73;
}

:root[data-theme="light"] .more-card,
:root[data-theme="light"] .changelog-item {
  border-color: rgba(36,120,111,0.12);
  background: rgba(255,255,255,0.78);
  color: var(--ink);
}

:root[data-theme="light"] .composer-plus-panel,
:root[data-theme="light"] .emoji-panel-tabs,
:root[data-theme="light"] .composer-action-card,
:root[data-theme="light"] .emoji-chip,
:root[data-theme="light"] .sticker-item {
  border-color: rgba(36,120,111,0.12);
  background: rgba(255,255,255,0.88);
  color: var(--ink);
}

:root[data-theme="light"] .more-card span,
:root[data-theme="light"] .changelog-head span,
:root[data-theme="light"] .changelog-points p {
  color: var(--ink-soft);
}

:root[data-theme="light"] .more-page-header strong,
:root[data-theme="light"] .more-back-btn,
:root[data-theme="light"] .changelog-head strong {
  color: var(--ink);
}

:root[data-theme="light"] .more-back-btn {
  background: rgba(36,120,111,0.12);
}

:root[data-theme="light"] .person-row .small-btn,
:root[data-theme="light"] .member-actions .small-btn,
:root[data-theme="light"] .action-group .small-btn,
:root[data-theme="light"] .mobile-menu-list .small-btn {
  background: var(--jade);
  color: #fff;
  border-color: transparent;
}

:root[data-theme="light"] .danger-btn,
:root[data-theme="light"] .mobile-menu-list .danger-item,
:root[data-theme="light"] .member-actions .danger-btn,
:root[data-theme="light"] .action-group .danger-btn {
  border: 1px solid rgba(183,77,69,0.16);
  background: #fff0ed;
  color: #9f3e36;
}

:root[data-theme="light"] .tab {
  color: var(--ink-soft);
}

:root[data-theme="light"] .tab.is-active {
  background: var(--jade);
  color: #fff;
}

:root[data-theme="light"] .global-user .small-btn,
:root[data-theme="light"] .global-user .small-btn.quiet,
:root[data-theme="light"] .global-user .ghost-link {
  border: 1px solid rgba(36,120,111,0.16);
  background: rgba(255,255,255,0.76);
  color: var(--jade);
  box-shadow: 0 8px 20px rgba(45,55,48,0.08);
}

:root[data-theme="light"] .global-user .small-btn:hover,
:root[data-theme="light"] .global-user .ghost-link:hover {
  background: var(--jade);
  color: #fff;
}

:root[data-theme="light"] .global-user span {
  color: var(--ink-soft);
}

:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .auth-panel,
:root[data-theme="dark"] .conversation,
:root[data-theme="dark"] .detail-card,
:root[data-theme="dark"] .bubble,
  :root[data-theme="dark"] .announcement-item,
  :root[data-theme="dark"] .reply-preview,
  :root[data-theme="dark"] .pending-image-preview,
  :root[data-theme="dark"] .profile-dialog,
:root[data-theme="dark"] .mobile-chat-menu,
:root[data-theme="dark"] .mobile-menu-list button {
  border-color: var(--paper-line);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018)),
    var(--paper);
  color: var(--ink);
}

:root[data-theme="dark"] .conversation-header,
:root[data-theme="dark"] .conversation-tools,
:root[data-theme="dark"] .composer,
:root[data-theme="dark"] .mobile-chat-menu header {
  border-color: var(--paper-line);
  background: rgba(18,27,23,0.88);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
}

:root[data-theme="dark"] .quick-replies button,
:root[data-theme="dark"] .message-actions button,
:root[data-theme="dark"] .reply-preview,
:root[data-theme="dark"] .small-btn,
:root[data-theme="dark"] .composer-plus-panel,
:root[data-theme="dark"] .emoji-panel-tabs,
:root[data-theme="dark"] .composer-action-card,
:root[data-theme="dark"] .emoji-chip,
:root[data-theme="dark"] .sticker-item {
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.07);
  color: var(--mint);
}

:root[data-theme="dark"] .primary-btn {
  color: #fff;
}

:root[data-theme="dark"] .danger-btn,
:root[data-theme="dark"] .mobile-menu-list .danger-item,
:root[data-theme="dark"] .member-actions .danger-btn,
:root[data-theme="dark"] .action-group .danger-btn {
  border: 1px solid rgba(255,136,122,0.2);
  background: rgba(183,77,69,0.18);
  color: #ffb7ad;
}

:root[data-theme="dark"] .person-row .small-btn,
:root[data-theme="dark"] .member-actions .small-btn,
:root[data-theme="dark"] .action-group .small-btn,
:root[data-theme="dark"] .mobile-menu-list .small-btn {
  background: rgba(158,217,201,0.18);
  color: #c8f3e8;
}

:root[data-theme="dark"] .image-placeholder {
  background: rgba(255,255,255,0.06);
  color: var(--mint);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 72px 320px minmax(0, 1fr);
  }

  .detail-rail {
    display: none;
  }

  .global-bar {
    grid-template-columns: 230px minmax(0, 1fr) auto;
  }

}

@media (max-width: 1320px) {
  .global-bar {
    grid-template-columns: 220px minmax(0, 1fr) auto;
  }

  .global-user {
    max-width: none;
  }
}

@media (max-width: 860px) {
  .auth-shell {
    padding: 14px;
  }

  .auth-card {
    grid-template-columns: 1fr;
    border-radius: 22px;
  }

  .auth-story {
    min-height: 440px;
    padding: 30px;
  }

  .auth-panel {
    padding: 26px;
  }

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

  .qiyu-shell {
    height: 100svh;
    height: 100dvh;
    min-height: 100svh;
    min-height: 100dvh;
    padding: 0;
    padding-bottom: 68px;
    gap: 0;
    overflow: hidden;
  }

  .global-bar {
    position: sticky;
    top: 0;
    z-index: 8;
    grid-template-columns: 1fr;
    border-width: 0 0 1px;
    border-radius: 0;
    min-height: 68px;
  }

  .global-center {
    display: none;
  }

  .global-user {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
    height: 100%;
    min-height: 0;
    gap: 0;
    overflow: hidden;
  }

  .left-rail {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    grid-template-columns: repeat(5, 1fr);
    align-content: stretch;
    gap: 0;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 0;
    background: rgba(16,22,18,0.96);
    backdrop-filter: blur(18px);
  }

  .tab {
    min-height: 54px;
    border-radius: 16px;
  }

  .tab span {
    writing-mode: horizontal-tb;
    letter-spacing: 0;
  }

  .tab-dot {
    top: 8px;
    right: calc(50% - 26px);
    border-color: rgba(16,22,18,0.96);
  }

  .people-pane,
  .conversation {
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
  }

  .people-pane {
    display: grid;
    height: calc(100svh - 68px - 68px);
    max-height: none;
  }

  .conversation {
    display: none;
    min-height: 0;
  }

  .qiyu-shell.is-chat-open {
    position: fixed;
    inset: 0;
    z-index: 50;
    grid-template-rows: minmax(0, 1fr);
    width: 100vw;
    height: 100svh;
    height: 100dvh;
    min-height: 0;
    padding-bottom: 0;
    overflow: hidden;
  }

  .qiyu-shell.is-chat-open .workspace {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .qiyu-shell.is-chat-open .global-bar,
  .qiyu-shell.is-chat-open .left-rail,
  .qiyu-shell.is-chat-open .people-pane {
    display: none;
  }

  .qiyu-shell.is-chat-open .conversation {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }

  .qiyu-shell.is-chat-open .conversation-header {
    z-index: 9;
    min-height: 62px;
    padding: 10px 12px;
  }

  .qiyu-shell.is-chat-open .messages {
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .qiyu-shell.is-chat-open .chat-title {
    gap: 8px;
  }

  .qiyu-shell.is-chat-open .chat-title .avatar,
  .qiyu-shell.is-chat-open .chat-title span {
    display: none;
  }

  .qiyu-shell.is-chat-open .chat-title strong {
    font-size: 17px;
  }

  .qiyu-shell.is-chat-open .header-actions > :not(.mobile-more-btn) {
    display: none;
  }

  .mobile-more-btn {
    display: inline-grid;
    min-width: 42px;
    place-items: center;
    padding: 0;
    font-size: 22px;
    line-height: 1;
  }

  .mobile-settings-logout {
    display: block;
    margin-top: 8px;
  }

  .message {
    max-width: 90%;
  }

  .mobile-back-btn {
    display: inline-grid;
    min-height: 38px;
    place-items: center;
    border: 0;
    border-radius: 13px;
    padding: 0 10px;
    background: rgba(47,111,115,0.1);
    color: var(--jade);
    font-weight: 950;
  }

  .qiyu-shell.is-menu-open .conversation {
    display: none;
  }

  .qiyu-shell.is-menu-open .mobile-chat-menu {
    display: grid;
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    background: var(--paper);
  }

  .mobile-chat-menu header {
    display: grid;
    min-height: 62px;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--paper-line);
    background: rgba(255,253,248,0.92);
    backdrop-filter: blur(16px);
  }

  .mobile-chat-menu header strong {
    justify-self: center;
    color: var(--ink);
    font-size: 17px;
  }

  .mobile-menu-list {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 16px;
  }

  .mobile-menu-list button {
    min-height: 54px;
    border: 1px solid var(--paper-line);
    border-radius: 16px;
    padding: 0 16px;
    background: #fff;
    color: var(--ink);
    font-size: 16px;
    font-weight: 900;
    text-align: left;
    box-shadow: var(--shadow-soft);
  }

  .mobile-menu-list .danger-item {
    color: var(--danger);
    background: #fff7f5;
  }

  .composer {
    grid-template-columns: 1fr;
    z-index: 6;
    width: 100%;
    max-width: 100%;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    flex-shrink: 0;
  }

  .composer textarea {
    min-height: 42px;
    max-height: 96px;
    overflow-y: auto;
  }

  .composer-plus-panel {
    max-height: min(360px, 42vh);
    padding: 10px;
  }

  .composer-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .emoji-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .composer-actions {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
  }

  #charCounter {
    display: none;
  }

  .composer-actions .small-btn,
  .composer-actions .primary-btn {
    min-width: 58px;
    padding: 0 10px;
  }

  .composer-actions .primary-btn {
    margin-left: 0;
  }

  #composerMoreBtn,
  #sendBtn {
    min-width: 58px;
  }

  .pending-image-preview {
    padding: 7px;
  }

  .pending-image-item {
    flex-basis: 96px;
    grid-template-rows: 62px auto;
  }

  .pending-image-item img {
    height: 62px;
  }

  .theme-choice-row {
    grid-template-columns: 1fr;
  }

  .message-actions {
    opacity: 1;
  }
}

@media (max-width: 460px) {
  .global-user .small-btn {
    min-width: 56px;
  }

  .messages {
    padding: 18px 14px;
  }

  .conversation-header {
    align-items: flex-start;
  }

  .header-actions {
    max-width: 138px;
  }

  .quick-replies {
    padding: 0 14px 12px;
  }
}
