/**
 * Shared customer service dialog.
 * This is the single visual implementation used by the home page and user pages.
 */

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime {
  --customer-overlay: rgba(3, 6, 13, .68);
  --customer-panel: #0d1420;
  --customer-panel-glow: radial-gradient(120% 70% at 0% 0%, rgba(0, 202, 224, .13), transparent 60%);
  --customer-panel-line: rgba(255, 255, 255, .09);
  --customer-panel-shadow: 0 30px 80px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .05);
  --customer-heading: #f3f7fb;
  --customer-text: rgba(207, 219, 230, .68);
  --customer-muted: rgba(207, 219, 230, .5);
  --customer-surface: rgba(255, 255, 255, .04);
  --customer-surface-line: rgba(255, 255, 255, .08);
  --customer-avatar-bg: linear-gradient(145deg, rgba(0, 202, 224, .16), rgba(255, 255, 255, .04));
  --customer-close-bg: rgba(255, 255, 255, .06);
  --customer-close-bg-hover: rgba(255, 255, 255, .12);
  --customer-close-text: rgba(235, 243, 250, .82);
  --customer-status-bg: rgba(34, 197, 94, .12);
  --customer-status-text: #6ee7a0;
  --customer-copy-bg: rgba(34, 197, 94, .14);
  --customer-copy-bg-hover: rgba(34, 197, 94, .22);
  --customer-copy-text: #6ee7a0;
  --customer-action-bg: linear-gradient(135deg, #00c2d8, #0a9fc4);
  --customer-action-bg-hover: linear-gradient(135deg, #14d0e4, #0caed4);
  --customer-action-text: #ffffff;
  --customer-ring: #0d1420;
  position: fixed;
  inset: 0;
  z-index: 2147483635;
  /* 用 100% 而非 100vw：Windows 常驻滚动条会让 100vw 比可视区宽，弹窗整体偏右。 */
  width: 100%;
  height: 100%;
  margin: 0;
  pointer-events: auto;
  color-scheme: dark;
}

html.jn-light-mode body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime,
html[data-theme=light] body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime,
html body.jn-light-mode #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime,
html body[data-theme=light] #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime {
  --customer-overlay: rgba(15, 30, 48, .38);
  --customer-panel: #ffffff;
  --customer-panel-glow: radial-gradient(120% 70% at 0% 0%, rgba(0, 184, 212, .09), transparent 60%);
  --customer-panel-line: rgba(15, 38, 56, .08);
  --customer-panel-shadow: 0 28px 70px rgba(15, 40, 65, .2), inset 0 1px 0 rgba(255, 255, 255, .9);
  --customer-heading: #0f2233;
  --customer-text: #5d6f7d;
  --customer-muted: #8796a2;
  --customer-surface: #f5f8fa;
  --customer-surface-line: rgba(15, 38, 56, .07);
  --customer-avatar-bg: linear-gradient(145deg, rgba(0, 184, 212, .12), #f2f6f9);
  --customer-close-bg: rgba(15, 38, 56, .05);
  --customer-close-bg-hover: rgba(15, 38, 56, .1);
  --customer-close-text: #4a5c6a;
  --customer-status-bg: rgba(22, 163, 74, .1);
  --customer-status-text: #15803d;
  --customer-copy-bg: rgba(22, 163, 74, .1);
  --customer-copy-bg-hover: rgba(22, 163, 74, .17);
  --customer-copy-text: #15803d;
  --customer-action-bg: linear-gradient(135deg, #00b4cf, #0789b5);
  --customer-action-bg-hover: linear-gradient(135deg, #00c2dc, #0796c4);
  --customer-ring: #ffffff;
  color-scheme: light;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime,
html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime *,
html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime *::before,
html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime *::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: max(20px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(20px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--customer-overlay);
  color: var(--customer-heading);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal.replica-customer-modal {
  position: relative;
  inset: auto;
  transform: none;
  display: flex;
  flex-direction: column;
  align-self: center;
  justify-self: center;
  width: min(340px, 100%);
  max-width: 340px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  margin: 0;
  padding: 22px 20px 20px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border: 1px solid var(--customer-panel-line);
  border-radius: 20px;
  background: var(--customer-panel-glow), var(--customer-panel);
  color: var(--customer-heading);
  box-shadow: var(--customer-panel-shadow);
  text-align: left;
  font-family: inherit;
  min-width: 0;
  min-height: 0;
}

/* 各页面遗留样式给面板加过光晕伪元素，这里统一关掉，避免叠在新布局上。 */
html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal.replica-customer-modal::before,
html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal.replica-customer-modal::after {
  content: none;
  display: none;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  margin: 0;
  padding: 0 0 2px;
  border: 0;
  border-radius: 50%;
  background: var(--customer-close-bg);
  color: var(--customer-close-text);
  box-shadow: none;
  font: inherit;
  font-size: 19px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  -webkit-text-fill-color: currentColor;
}


html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  justify-content: normal;
  gap: 12px;
  margin: 0;
  padding: 0 36px 0 0;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--customer-surface-line);
  border-radius: 14px;
  background: var(--customer-avatar-bg);
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-avatar::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 13px;
  height: 13px;
  border: 2.5px solid var(--customer-ring);
  border-radius: 50%;
  background: #22c55e;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  object-fit: contain;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-head-text {
  display: grid;
  gap: 6px;
  min-width: 0;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-title {
  display: block;
  margin: 0;
  padding: 0;
  overflow: hidden;
  color: var(--customer-heading);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-text-fill-color: currentColor;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-status {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  height: 20px;
  margin: 0;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--customer-status-bg);
  color: var(--customer-status-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  -webkit-text-fill-color: currentColor;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-status-dot {
  display: block;
  width: 6px;
  height: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--customer-status-text);
  color: var(--customer-status-text);
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-sep {
  display: block;
  flex: none;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--customer-muted);
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-subtitle {
  min-width: 0;
  overflow: hidden;
  color: var(--customer-muted);
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-text-fill-color: currentColor;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-desc {
  display: block;
  margin: 14px 0 0;
  padding: 0;
  color: var(--customer-text);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-text-fill-color: currentColor;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-qr {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: 16px 0 0;
  padding: 18px 16px 14px;
  border: 1px solid var(--customer-surface-line);
  border-radius: 16px;
  background: var(--customer-surface);
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-qr-frame {
  display: block;
  width: 188px;
  height: 188px;
  margin: 0;
  padding: 10px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-qr-frame img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #ffffff;
  object-fit: contain;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-qr-tip {
  display: block;
  margin: 0;
  padding: 0;
  color: var(--customer-muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  -webkit-text-fill-color: currentColor;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-wechat {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 0;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--customer-surface-line);
  border-radius: 12px;
  background: var(--customer-surface);
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-wechat-label {
  flex: none;
  color: var(--customer-muted);
  font-size: 12px;
  line-height: 1;
  -webkit-text-fill-color: currentColor;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-wechat-id {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--customer-heading);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
  -webkit-user-select: all;
  -webkit-text-fill-color: currentColor;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-wechat-copy {
  flex: none;
  height: 28px;
  min-height: 28px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--customer-copy-bg);
  color: var(--customer-copy-text);
  box-shadow: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 28px;
  cursor: pointer;
  transition: background .15s ease;
  -webkit-text-fill-color: currentColor;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-wechat-copy.is-copied {
  background: var(--customer-copy-bg-hover);
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-empty {
  display: block;
  margin: 16px 0 0;
  padding: 16px;
  border: 1px dashed var(--customer-surface-line);
  border-radius: 12px;
  background: transparent;
  color: var(--customer-text);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  -webkit-text-fill-color: currentColor;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-actions {
  display: block;
  margin: 16px 0 0;
  padding: 0;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--customer-action-bg);
  color: var(--customer-action-text);
  box-shadow: 0 8px 20px rgba(0, 160, 200, .22);
  font-size: 14px;
  font-weight: 600;
  line-height: normal;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-text-fill-color: currentColor;
}

html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-action::after {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  margin: 0 0 0 8px;
  border-top: 1.75px solid currentColor;
  border-right: 1.75px solid currentColor;
  transform: rotate(45deg);
}

/* 鼠标设备才有悬停态；手机点按后不会残留高亮。 */
@media (hover: hover) {
  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal-close:hover {
    background: var(--customer-close-bg-hover);
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-wechat-copy:hover {
    background: var(--customer-copy-bg-hover);
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-action:hover {
    background: var(--customer-action-bg-hover);
  }
}

/* 触屏加大关闭与复制按钮的点按区域。 */
@media (pointer: coarse) {
  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal-close {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    font-size: 21px;
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-wechat-copy {
    height: 34px;
    min-height: 34px;
    padding: 0 14px;
    line-height: 34px;
  }
}

@media (max-width: 760px) {
  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal-overlay {
    padding: max(14px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal.replica-customer-modal {
    max-height: calc(100vh - 28px);
    max-height: calc(100dvh - 28px);
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-qr-frame {
    width: 172px;
    height: 172px;
  }
}

/* 矮屏：Windows 笔记本开 125%/150% 缩放、浏览器工具栏较多，或手机横屏时，收紧间距并缩小二维码，尽量一屏看全。 */
@media (max-height: 640px) {
  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal-overlay {
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal.replica-customer-modal {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 18px 18px 16px;
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-desc {
    margin-top: 10px;
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-qr {
    gap: 8px;
    margin-top: 12px;
    padding: 12px 12px 10px;
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-qr-frame {
    width: 148px;
    height: 148px;
    padding: 8px;
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-actions {
    margin-top: 12px;
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-action {
    height: 40px;
    min-height: 40px;
  }
}

@media (max-height: 460px) {
  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal.replica-customer-modal {
    padding: 14px 16px;
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-desc {
    display: none;
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-qr {
    gap: 6px;
    margin-top: 10px;
    padding: 8px 10px;
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-qr-frame {
    width: 100px;
    height: 100px;
    padding: 5px;
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-wechat {
    margin-top: 8px;
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .jn-cs-actions {
    margin-top: 10px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal-overlay {
    animation: jn-customer-overlay-in .18s ease both;
  }

  html body #jnCustomerServiceRuntime#jnCustomerServiceRuntime#jnCustomerServiceRuntime .customer-modal.replica-customer-modal {
    animation: jn-customer-modal-in .22s cubic-bezier(.2, .8, .2, 1) both;
  }
}

@keyframes jn-customer-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes jn-customer-modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
