:root {
  color-scheme: light;
  --xy-yellow: #ffda00;
  --ink: #202124;
  --muted: #8b9098;
  --line: #eceff3;
  --panel: #ffffff;
  --soft: #f6f7f9;
  --active: #fff6cf;
  --danger: #ef4444;
  --online: #12b886;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #e7e7e7;
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 72px 0 0;
  z-index: -1;
  background-color: #e9e9e9;
  background-image:
    radial-gradient(circle at 14% 22%, rgba(185, 185, 185, 0.18) 0 42px, transparent 43px),
    radial-gradient(circle at 87% 30%, rgba(185, 185, 185, 0.16) 0 64px, transparent 65px),
    linear-gradient(135deg, rgba(170, 170, 170, 0.14) 0 2px, transparent 2px 28px);
  background-size: 360px 260px, 420px 320px, 56px 56px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.hidden {
  display: none !important;
}

.xy-topbar {
  height: 72px;
  background: var(--xy-yellow);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

.xy-topbar-inner {
  width: min(1060px, calc(100vw - 112px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.xy-logo {
  flex: 0 0 auto;
  font-size: 36px;
  line-height: 1;
  font-weight: 900;
  color: #111827;
}

.xy-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  visibility: hidden;
}

body.workspace-ready .xy-actions {
  visibility: visible;
}

.ghost-button,
.dark-button,
.account-mini-button,
.sendbox button,
dialog button,
.login-panel button {
  height: 34px;
  border-radius: 7px;
  padding: 0 14px;
  font-weight: 650;
  white-space: nowrap;
}

.ghost-button,
.account-mini-button {
  background: rgba(255, 255, 255, 0.58);
  color: #16181d;
}

.dark-button,
.sendbox button,
dialog button,
.login-panel button {
  background: #17191f;
  color: #ffffff;
}

.account-pills {
  min-width: 0;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.account-pill {
  min-width: 150px;
  max-width: 240px;
  height: 38px;
  padding: 0 8px 0 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.account-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
}

.account-dot.online {
  background: var(--online);
  box-shadow: 0 0 0 3px rgba(18, 184, 134, 0.14);
}

.account-dot.connecting {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.account-mini-button {
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
}

#app {
  height: calc(100vh - 72px);
}

.login-panel {
  width: min(380px, calc(100vw - 32px));
  margin: 12vh auto 0;
  padding: 30px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.login-panel h1 {
  margin: 0 0 22px;
  font-size: 22px;
}

.login-panel input {
  width: 100%;
  height: 42px;
  margin-bottom: 12px;
  padding: 0 12px;
  border: 1px solid #d9dde4;
  border-radius: 8px;
  outline: none;
}

.login-panel input:focus,
.sendbox textarea:focus {
  border-color: #111827;
}

.login-panel button {
  width: 100%;
  height: 42px;
}

.error {
  min-height: 20px;
  color: #b91c1c;
}

.workspace {
  height: 100%;
  padding: 14px 80px 18px;
}

.im-shell {
  width: min(1036px, 100%);
  height: min(760px, calc(100vh - 104px));
  min-height: 600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  overflow: hidden;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(31, 41, 55, 0.08);
}

.sidebar {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  display: grid;
  grid-template-rows: 60px minmax(0, 1fr);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.toolbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar strong {
  font-size: 18px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.unread-badge,
.row-unread {
  min-width: 24px;
  height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ff4d57;
  color: #ffffff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  font-weight: 800;
}

.conversations {
  overflow: auto;
  padding: 2px 0 12px;
}

.conversation {
  height: 70px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  padding: 7px 10px 7px 12px;
  cursor: pointer;
}

.conversation:hover,
.conversation.active {
  background: var(--active);
}

.avatar,
.item-thumb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;
  flex: 0 0 auto;
}

.item-thumb {
  border-radius: 8px;
  font-size: 11px;
  color: rgba(17, 24, 39, 0.74);
}

.tone-0 {
  background: linear-gradient(145deg, #71d5ff, #2f80ed);
}

.tone-1 {
  background: linear-gradient(145deg, #ffd166, #ef476f);
}

.tone-2 {
  background: linear-gradient(145deg, #9be7c1, #06a77d);
}

.tone-3 {
  background: linear-gradient(145deg, #c4b5fd, #7c3aed);
}

.tone-4 {
  background: linear-gradient(145deg, #fbcfe8, #db2777);
}

.thumb-0 {
  background: #e0f2fe;
}

.thumb-1 {
  background: #fef3c7;
}

.thumb-2 {
  background: #dcfce7;
}

.thumb-3 {
  background: #ede9fe;
}

.thumb-4 {
  background: #ffe4e6;
}

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

.conversation-top,
.conversation-summary {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.conversation-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 750;
}

.conversation-time {
  margin-left: auto;
  flex: 0 0 auto;
  color: #a0a5ad;
  font-size: 11px;
}

.conversation-summary {
  margin-top: 3px;
  color: #9ca3af;
  font-size: 12px;
}

.summary-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.chat {
  min-width: 0;
  display: grid;
  grid-template-rows: 60px minmax(0, 1fr) auto;
  background: #ffffff;
}

.chat-header {
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  grid-row: 2 / 4;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #7f8790;
}

.empty-state strong {
  color: #5b616a;
  font-size: 14px;
}

.empty-state span {
  font-size: 12px;
}

.mascot {
  position: relative;
  width: 92px;
  height: 76px;
  border-radius: 48% 52% 46% 54%;
  background: var(--xy-yellow);
  box-shadow: inset -9px -10px 0 rgba(255, 169, 0, 0.28), 0 10px 18px rgba(255, 196, 0, 0.18);
}

.mascot::before {
  content: "";
  position: absolute;
  left: 50px;
  top: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--xy-yellow);
}

.mascot-eye {
  position: absolute;
  top: 25px;
  width: 16px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
}

.mascot-eye.left {
  left: 34px;
}

.mascot-eye.right {
  left: 54px;
}

.mascot-eye::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #111827;
}

.mascot-mouth {
  position: absolute;
  left: 51px;
  top: 48px;
  width: 18px;
  height: 8px;
  border-bottom: 3px solid #f97316;
  border-radius: 50%;
}

.mascot-card {
  position: absolute;
  left: 0;
  top: 42px;
  width: 25px;
  height: 32px;
  border-radius: 6px;
  background: #ff6b6b;
  transform: rotate(-7deg);
  box-shadow: inset 0 -8px 0 rgba(255, 255, 255, 0.16);
}

.messages {
  min-height: 0;
  padding: 18px 22px;
  overflow: auto;
  background:
    linear-gradient(#ffffff, #ffffff),
    var(--soft);
}

.message {
  width: fit-content;
  max-width: min(72%, 560px);
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f3f4f6;
  color: #202124;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
  font-size: 14px;
}

.message.seller {
  margin-left: auto;
  background: #fff0a8;
}

.message .meta {
  margin-top: 4px;
  color: rgba(32, 33, 36, 0.46);
  font-size: 11px;
}

.sendbox {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.sendbox textarea {
  resize: none;
  min-height: 54px;
  max-height: 128px;
  border: 1px solid #dce0e6;
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}

.sendbox button {
  height: 54px;
  align-self: end;
}

dialog {
  width: min(360px, calc(100vw - 32px));
  border: 0;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
}

dialog::backdrop {
  background: rgba(17, 24, 39, 0.42);
}

dialog h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

#qrImage {
  display: block;
  width: 260px;
  height: 260px;
  margin: 14px auto;
  border-radius: 10px;
  background: #f3f4f6;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .xy-topbar-inner {
    width: calc(100vw - 32px);
  }

  .account-pills {
    max-width: 260px;
  }

  .workspace {
    padding: 18px 16px 24px;
  }

  .im-shell {
    min-height: calc(100vh - 124px);
    height: calc(100vh - 124px);
  }
}

@media (max-width: 760px) {
  .xy-topbar {
    height: auto;
    min-height: 72px;
  }

  .xy-topbar-inner {
    min-height: 72px;
    flex-wrap: wrap;
    padding: 10px 0;
  }

  #app {
    height: auto;
    min-height: calc(100vh - 72px);
  }

  .xy-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .account-pills {
    max-width: none;
  }

  .workspace {
    height: auto;
  }

  .im-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 300px minmax(420px, 1fr);
    height: auto;
    min-height: 720px;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
