/* 客服页顶栏：覆盖 event 路由对 lobby-base-header 的隐藏 */
html[data-cs-route="notice"] .lobby-base-header,
html[data-cs-notice="1"] .lobby-base-header,
html[data-cs-route="notice"] [class*="notice-header"],
html[data-cs-notice="1"] [class*="notice-header"],
html[data-cs-route="service"] .lobby-base-header {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

html[data-cs-route="notice"] .lobby-base-header__back,
html[data-cs-notice="1"] .lobby-base-header__back,
html[data-cs-route="service"] .lobby-base-header__back {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* 消息中心 - 客服 Tab 双入口 */
[class*="online-customers-wrapper"],
[class*="online-customers"] {
  background: transparent !important;
}

[class*="online-customers"] [class*="button-mobile"] {
  display: none !important;
}

[class*="other-customers"],
[class*="service-other-customers"] {
  display: none !important;
}

/* 禁止图一客服弹窗 */
[class*="service-online-list"],
[class*="serviceOnlineList"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.van-popup:has([class*="service-online-list"]),
.van-popup:has([class*="serviceOnlineList"]) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

[class*="inner-online-customers"] {
  text-align: center;
  padding: 0.28rem 0.2rem 0.12rem;
}

[class*="default-title"] {
  font-size: 0.34rem !important;
  font-weight: 700 !important;
  color: #e3e3e3 !important;
  -webkit-text-fill-color: #e3e3e3 !important;
}

[class*="default-describe"] {
  margin-top: 0.12rem;
  font-size: 0.24rem !important;
  color: #999 !important;
  line-height: 1.5;
}

.cs-hub-picker-actions {
  display: flex;
  align-items: stretch;
  border-top: 1px solid #f0f0f0;
  margin-top: 0.12rem;
}

.cs-hub-choice {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  padding: 0.34rem 0.12rem;
  border: 0;
  background: #fff;
  color: #ff6700;
  font-size: 0.28rem;
  cursor: pointer;
}

.cs-hub-choice + .cs-hub-choice {
  border-left: 1px solid #f0f0f0;
}

.cs-hub-choice-img {
  width: 0.44rem;
  height: 0.44rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.cs-hub-choice-text { font-weight: 500; }
.cs-hub-choice-arrow { font-size: 0.34rem; line-height: 1; opacity: 0.9; }

/* 用户在线客服页 */
html.cs-chat-root {
  font-size: calc(min(100vw, 430px) / 7.5);
}

html, body {
  height: 100%;
  margin: 0;
  background: #e9ecf1;
}

.cs-embed .csu-header,
.cs-embed-shell .csu-header {
  display: none;
}

html.cs-chat-root,
html.cs-chat-root body.cs-chat-page {
  height: 100%;
  overflow: hidden;
}

.cs-embed.cs-chat-page {
  min-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.cs-embed #csShell,
.cs-embed-shell {
  flex: 1;
  min-height: 0;
  min-height: 100%;
  max-width: none;
  box-shadow: none;
}

.cs-embed .csu-body,
.cs-embed-shell .csu-body {
  flex: 1;
}

/* SPA 内嵌客服 iframe */
[class*="pages-service-iframe"] [class*="_iframe_"],
iframe[src*="/pages/cs/chat"] {
  width: 100% !important;
  max-width: 430px !important;
  margin: 0 auto !important;
  display: block !important;
  background: #f3f5f8 !important;
}

.csu-shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: #f3f5f8;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.06);
  width: 100%;
  flex: 1;
  min-height: 0;
}

.cs-chat-page {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #222;
}

.csu-header {
  display: flex;
  align-items: center;
  gap: 0.16rem;
  padding: 0.22rem 0.24rem;
  background: #fff;
  border-bottom: 1px solid #edf0f4;
}

.csu-back {
  border: 0;
  background: transparent;
  font-size: 0.5rem;
  line-height: 1;
  color: #333;
  padding: 0 0.08rem;
}

.csu-head-avatar {
  width: 0.56rem;
  height: 0.56rem;
  border-radius: 50%;
  object-fit: cover;
}

.csu-head-title {
  font-size: 0.3rem;
  font-weight: 600;
}

.csu-head-status {
  font-size: 0.22rem;
  color: #16a34a;
  margin-top: 0.04rem;
}

.csu-agent-card {
  display: flex;
  gap: 0.2rem;
  margin: 0.2rem 0.24rem 0;
  padding: 0.24rem;
  background: #fff;
  border-radius: 0.16rem;
  box-shadow: 0 0.04rem 0.16rem rgba(0, 0, 0, 0.04);
}

.csu-agent-avatar {
  width: 0.88rem;
  height: 0.88rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.csu-agent-name-row {
  display: flex;
  align-items: center;
  gap: 0.12rem;
  flex-wrap: wrap;
}

.csu-agent-name {
  font-size: 0.3rem;
  font-weight: 700;
}

.csu-agent-badge {
  font-size: 0.2rem;
  color: #2563eb;
  background: #eff6ff;
  border-radius: 0.08rem;
  padding: 0.04rem 0.1rem;
}

.csu-agent-desc {
  margin-top: 0.12rem;
  font-size: 0.24rem;
  color: #666;
  line-height: 1.5;
}

.csu-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.24rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.csu-body::-webkit-scrollbar {
  display: none;
}

.csu-empty {
  text-align: center;
  color: #999;
  font-size: 0.26rem;
  padding: 1rem 0.4rem;
}

.csu-time {
  text-align: center;
  color: #999;
  font-size: 0.22rem;
  margin: 0.16rem 0;
}

.csu-row {
  display: flex;
  align-items: flex-end;
  gap: 0.12rem;
  margin-bottom: 0.2rem;
  width: 100%;
  clear: both;
}

.csu-row.is-user {
  justify-content: flex-end;
}

.csu-row.is-agent {
  justify-content: flex-start;
}

.csu-msg-avatar {
  width: 0.56rem;
  height: 0.56rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.csu-bubble {
  max-width: 72%;
  padding: 0.2rem 0.24rem;
  border-radius: 0.16rem;
  font-size: 0.28rem;
  line-height: 1.5;
  word-break: break-word;
}

.csu-row.is-agent .csu-bubble {
  background: #fff;
  color: #333;
  border-bottom-left-radius: 0.04rem;
  box-shadow: 0 0.02rem 0.08rem rgba(0, 0, 0, 0.05);
}

.csu-row.is-user .csu-bubble {
  background: #3b82f6;
  color: #fff;
  border-bottom-right-radius: 0.04rem;
}

.csu-read {
  font-size: 0.2rem;
  color: #9ca3af;
  align-self: flex-end;
  padding-bottom: 0.06rem;
}
.csu-read.is-read { color: #16a34a; }

.csu-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.12rem 0.16rem;
  padding: 0.2rem 0.24rem calc(0.2rem + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #edf0f4;
  align-items: center;
}

.csu-tools {
  display: flex;
  gap: 0.12rem;
  width: 100%;
}

.csu-tool-btn {
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 0.12rem;
  width: 0.64rem;
  height: 0.64rem;
  font-size: 0.32rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.csu-emoji-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.08rem;
  width: 100%;
  padding: 0.12rem;
  background: #f3f4f6;
  border-radius: 0.12rem;
}

.csu-emoji-panel[hidden] {
  display: none !important;
}

.csu-emoji-item {
  border: 0;
  background: transparent;
  font-size: 0.36rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.04rem;
}

.csu-bubble-img {
  max-width: 2.4rem;
  border-radius: 0.12rem;
  display: block;
  cursor: zoom-in;
}

.csu-img-preview {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.csu-img-preview[hidden] {
  display: none !important;
}

.csu-img-preview-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
}

.csu-img-preview img {
  position: relative;
  z-index: 1;
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 0.12rem;
  object-fit: contain;
}

.csu-input-row {
  display: flex;
  gap: 0.16rem;
  width: 100%;
  align-items: stretch;
}

.csu-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 0.12rem;
  padding: 0 0.22rem;
  font-size: 0.28rem;
  outline: none;
  height: 0.72rem;
  box-sizing: border-box;
}

.csu-send {
  border: 0;
  border-radius: 0.12rem;
  padding: 0 0.32rem;
  min-width: 1.12rem;
  height: 0.72rem;
  box-sizing: border-box;
  background: #3b82f6;
  color: #fff;
  font-size: 0.28rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
