:root {
  --app-height: 100dvh;
  --app-top: 0px;
  --bg: #eef2f6;
  --panel: #ffffff;
  --line: #d9e2ea;
  --text: #17212b;
  --muted: #657684;
  --primary: #0d6efd;
  --primary-hover: #0958ca;
  --mine: #dcecff;
  --system: #fff2cf;
  --danger: #bd2d2d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", Arial, sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

button,
input,
textarea {
  font: inherit;
  font-size: 16px;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.mobile-app {
  position: fixed;
  top: var(--app-top);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: var(--app-height);
  min-height: 0;
  margin: 0 auto;
  background: var(--panel);
  overflow: hidden;
}

.screen {
  height: 100%;
  min-height: 0;
  background: var(--panel);
}

.auth-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: max(22px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
}

.auth-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(135deg, #0d6efd 0%, #19a1ff 100%);
  font-size: 26px;
  font-weight: 800;
}

.auth-head h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.15;
}

.auth-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f5f8fb;
}

.switch-btn,
.ghost-btn {
  height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.switch-btn.active {
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(23, 33, 43, 0.08);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  font-size: 14px;
  color: #42515f;
}

.text-input,
.chat-input {
  width: 100%;
  border: 1px solid #c9d5df;
  border-radius: 11px;
  outline: none;
  background: #fff;
  color: var(--text);
}

.text-input {
  height: 46px;
  padding: 0 13px;
}

.text-input:focus,
.chat-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12);
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: end;
}

.captcha-box {
  display: grid;
  gap: 7px;
}

.captcha-box span {
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px dashed #94a9bd;
  border-radius: 11px;
  background: #f2f7ff;
  color: #0a4c94;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 4px;
}

.ghost-btn {
  height: 38px;
  border: 1px solid var(--line);
  background: #f7fafc;
  color: #314455;
}

.primary-btn {
  height: 46px;
  border: 0;
  border-radius: 11px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn:active {
  background: var(--primary-hover);
}

.full {
  width: 100%;
}

.form-message {
  min-height: 22px;
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.form-message.error {
  color: var(--danger);
}

.form-message.success {
  color: #177a45;
}

.hidden {
  display: none !important;
}

.chat-screen {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.chat-screen.keyboard-open,
.service-screen.keyboard-open {
  height: var(--app-height);
}

.chat-screen.keyboard-open {
  grid-template-rows: 0 auto minmax(0, 1fr) auto;
}

.chat-screen.keyboard-open .chat-header {
  height: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.chat-header {
  position: relative;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 10px 9px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  overflow: visible;
}

.room-heading {
  overflow: hidden;
  min-width: 0;
}

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

.chat-header h2 {
  margin: 0;
  max-width: 100%;
  font-size: 15px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.header-actions span {
  color: var(--muted);
  font-size: 11px;
}

.service-btn {
  position: relative;
  height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0 9px;
  background: linear-gradient(135deg, #ff8a00 0%, #ff4d4f 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 28px;
  box-shadow: 0 6px 14px rgba(255, 77, 79, 0.24);
  cursor: pointer;
}

.service-btn:active {
  transform: translateY(1px);
  box-shadow: 0 3px 8px rgba(255, 77, 79, 0.22);
}

.service-btn.has-unread {
  animation: servicePulse 1s ease-in-out infinite;
}

.service-btn.has-unread::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #ffeb3b;
  box-shadow: 0 0 0 4px rgba(255, 235, 59, 0.22);
}

@keyframes servicePulse {
  0%,
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 6px 14px rgba(255, 77, 79, 0.24);
  }
  50% {
    transform: translateY(-1px) scale(1.06);
    box-shadow: 0 8px 20px rgba(255, 77, 79, 0.42);
  }
}

.account-card {
  position: relative;
  display: contents;
  text-align: right;
}

.account-info {
  min-width: 0;
}

.account-menu-btn {
  width: 36px;
  height: 30px;
  border: 1px solid #d4dee7;
  border-radius: 10px;
  padding: 0;
  background: #f7fafc;
  color: #334155;
  font-size: 20px;
  font-weight: 800;
  line-height: 22px;
}

.account-menu {
  position: absolute;
  top: calc(100% - 2px);
  right: 10px;
  z-index: 30;
  width: 168px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
}

.account-menu-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 8px;
  text-align: left;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.avatar-svg {
  display: block;
}

.account-card span,
.account-card b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card span {
  color: #55708a;
  font-size: 11px;
}

.account-card b {
  margin-top: 2px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.logout-btn {
  width: 100%;
  height: 34px;
  border: 1px solid #d4dee7;
  border-radius: 9px;
  padding: 0;
  background: #f7fafc;
  color: #42515f;
  font-size: 12px;
  cursor: pointer;
}

.logout-btn:active {
  background: #edf2f7;
}

.announcement-bar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid #ffe2b8;
  background: #fff7ed;
  color: #9a3412;
  text-align: left;
  cursor: pointer;
}

.announcement-bar span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 7px;
  background: #ff8a00;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.announcement-bar p {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.install-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  background: #1677ff;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(22, 119, 255, 0.22);
}

.notice-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.notice-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.notice-sheet {
  position: relative;
  width: min(430px, 100%);
  max-height: 72dvh;
  border: 1px solid #ffd19b;
  border-radius: 18px;
  background: linear-gradient(180deg, #fffaf4 0%, #ffffff 42%);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.24);
  padding: 0;
  overflow: hidden;
}

.notice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #ffe2b8;
  padding: 14px 14px 12px;
  background: #fff7ed;
}

.notice-head h3 {
  margin: 0;
  font-size: 20px;
}

.notice-head button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: #9a3412;
  font-size: 24px;
  line-height: 30px;
}

.notice-content {
  max-height: calc(72dvh - 66px);
  overflow-y: auto;
  padding: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}

.message-list {
  overflow-y: auto;
  padding: 8px 8px;
  background: #f5f7fa;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.message-list::-webkit-scrollbar {
  display: none;
}

.message-item {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  width: fit-content;
  max-width: 82%;
  margin-bottom: 6px;
}

.message-item.mine {
  flex-direction: row-reverse;
  margin-left: auto;
}

.message-item.system {
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-width: 88%;
}

.message-bubble {
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.message-item.mine .message-bubble {
  background: var(--mine);
  border-color: #bdd7ff;
}

.message-item.service .message-bubble {
  border-color: #ffb15f;
  background: #fff7ed;
}

.message-item.service .message-name {
  color: #c2410c;
}

.message-item.service .message-body {
  color: #7c2d12;
  font-weight: 400;
}

.message-item.robot .message-body {
  font-weight: 700;
}

.message-item.system .message-bubble {
  background: var(--system);
  border-color: #efdba9;
}

.message-avatar {
  width: 30px;
  padding-top: 1px;
  flex: 0 0 30px;
}

.message-avatar .avatar-svg {
  width: 30px;
  height: 30px;
}

.message-top {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
}

.message-name {
  max-width: 120px;
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-time {
  white-space: nowrap;
}

.message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.35;
  font-size: 12px;
}

.chat-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 8px;
  align-items: end;
  padding: 10px 10px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #fff;
}

.chat-input {
  height: 44px;
  max-height: 112px;
  resize: none;
  padding: 10px 12px;
  line-height: 1.4;
}

.send-btn {
  width: 70px;
}

.service-footer {
  grid-template-columns: 54px minmax(0, 1fr) 70px;
}

.file-input {
  display: none;
}

.image-btn {
  height: 44px;
  border: 1px solid #d4dee7;
  border-radius: 11px;
  background: #f7fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.service-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.service-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 14px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.service-title-box {
  min-width: 0;
  flex: 1 1 auto;
  text-align: center;
}

.service-title-box h2 {
  margin: 0;
  overflow: hidden;
  font-size: 20px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-title-box p {
  margin: 5px 0 0;
  color: #16a34a;
  font-size: 12px;
  font-weight: 700;
}

.back-btn {
  width: 48px;
  height: 32px;
  border: 1px solid #d4dee7;
  border-radius: 10px;
  background: #f7fafc;
  color: #334155;
  font-size: 13px;
  cursor: pointer;
}

.service-agent-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff8a00 0%, #ff4d4f 100%);
  color: #fff;
  font-weight: 800;
}

.service-chat-list {
  overflow-y: auto;
  padding: 14px 12px;
  background: #f5f7fa;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.service-chat-list::-webkit-scrollbar {
  display: none;
}

.service-message {
  width: fit-content;
  max-width: 82%;
  margin-bottom: 12px;
}

.service-message.mine {
  margin-left: auto;
}

.service-message-body {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.service-message.mine .service-message-body {
  border-color: #bdd7ff;
  background: var(--mine);
}

.service-message-body.image-body {
  padding: 6px;
  background: #fff;
}

.service-message-body img {
  display: block;
  max-width: min(210px, 62vw);
  max-height: 240px;
  border-radius: 9px;
  object-fit: contain;
  cursor: zoom-in;
}

.image-preview {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 15, 26, 0.82);
}

.image-preview img {
  max-width: 100%;
  max-height: 86dvh;
  border-radius: 12px;
  object-fit: contain;
}

.image-preview button {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font-size: 28px;
  line-height: 34px;
}

.service-message-name {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
