.jumei-service {
  --service-brand-gradient: linear-gradient(105deg, #1268ea 0%, #2857df 42%, #4d43dc 70%, #7337dc 100%);
  --service-bottom: max(clamp(18px, calc(100vh - 430px), 280px), calc(var(--media-cart-height, 0px) + 12px));
  --service-offset: max(var(--service-bottom), var(--service-extra-bottom, 0px));
  position: fixed;
  bottom: var(--service-offset);
  left: 20px;
  z-index: 235;
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  pointer-events: none;
}

.jumei-service[data-surface="member"] { left: calc(var(--member-compact-sidebar, 230px) + 12px); }
.jumei-service [hidden] { display: none !important; }

.jumei-service-launcher,
.jumei-service-panel {
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}

.jumei-service-launcher {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--service-brand-gradient);
  color: #fff;
  box-shadow: 0 6px 18px rgba(52, 83, 191, .23);
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.jumei-service-launcher i { font-size: 18px; }

.jumei-service-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  width: min(182px, calc(100vw - 32px));
  max-height: max(150px, calc(100vh - var(--service-offset) - var(--service-clearance, 90px)));
  max-height: max(150px, calc(100dvh - var(--service-offset) - var(--service-clearance, 90px)));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  box-sizing: border-box;
  border: 1px solid #1268ea;
  border-radius: 14px;
  background: var(--service-brand-gradient);
  box-shadow: 0 10px 26px rgba(27, 65, 145, .21);
}

.jumei-service[data-expanded="true"] .jumei-service-panel,
.jumei-service[data-expanded="false"] .jumei-service-launcher {
  pointer-events: auto;
}

.jumei-service[data-expanded="false"] .jumei-service-panel,
.jumei-service[data-expanded="true"] .jumei-service-launcher {
  opacity: 0;
  visibility: hidden;
  transform: translateX(-6px);
}

.jumei-service-header {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 4px 6px;
  padding: 8px;
  border-bottom: 1px solid transparent;
  background: transparent;
}

.jumei-service-header > div { display: contents; }

.jumei-service-icon {
  display: grid;
  grid-area: 1 / 1;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, .15);
  color: #e7f2ff;
  font-size: 16px;
}

.jumei-service-header h2 { grid-area: 1 / 2; margin: 0; color: #fff; font-size: 16px; line-height: 1.35; }
.jumei-service-header p { grid-area: 2 / 1 / auto / -1; margin: 0; color: #e5efff; font-size: 13px; }

.jumei-service-close,
.jumei-service-copy {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 6px;
  background: rgba(255, 255, 255, .06);
  color: #eef6ff;
  cursor: pointer;
}

.jumei-service-close {
  grid-area: 1 / 3;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 16px;
}

.jumei-service-copy { width: 22px; height: 23px; flex: 0 0 22px; padding: 0; font: inherit; }
.jumei-service :is(.jumei-service-close, .jumei-service-copy):hover { background: rgba(255, 255, 255, .15); }
.jumei-service :is(a, button):focus-visible { outline: 2px solid #cfe5ff; outline-offset: 2px; }

.jumei-service-details {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.jumei-service-profile {
  display: flex;
  align-items: center;
  gap: 7px;
}

.jumei-service-profile img { width: 32px; height: 32px; object-fit: cover; border-radius: 50%; }
.jumei-service-profile strong { font-size: 15px; overflow-wrap: anywhere; }

.jumei-service-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
}

.jumei-service-contact > div { display: flex; align-items: baseline; min-width: 0; }
.jumei-service-contact span { flex: none; color: #e5efff; white-space: nowrap; }
.jumei-service-contact :is(a, strong) {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-family: Arial, sans-serif;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jumei-service-contact a { text-decoration: none; }
.jumei-service-contact a:hover { text-decoration: underline; }

.jumei-service-qr {
  display: grid;
  justify-items: center;
  gap: 3px;
  margin: 0;
  color: #e7f0ff;
  font-size: 13px;
  text-align: center;
}

.jumei-service-qr img {
  display: block;
  width: 110px;
  height: 110px;
  padding: 10px;
  box-sizing: content-box;
  object-fit: contain;
  border-radius: 5px;
  background: #fff;
}
.jumei-service-status { margin: 0; color: #eef5ff; }
.jumei-service-status:empty { display: none; }

.jumei-service-footer {
  padding: 5px 3px;
  border-top: 1px solid rgba(255, 255, 255, .15);
  background: transparent;
  color: #eef5ff;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 1099px), (max-height: 639px) {
  .jumei-service { --service-bottom: max(18px, calc(var(--media-cart-height, 0px) + 10px)); left: 12px; }
  .jumei-service-panel { max-height: min(62vh, max(150px, calc(100vh - var(--service-offset) - var(--service-clearance, 58px)))); }
  .jumei-service-panel { max-height: min(62dvh, max(150px, calc(100dvh - var(--service-offset) - var(--service-clearance, 58px)))); }
}

@media (max-width: 1049px) {
  .jumei-service[data-surface="member"] { left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .jumei-service-launcher, .jumei-service-panel { transition: none; }
}
