.consultation-dock {
  --dock-safe-top: env(safe-area-inset-top, 0px);
  --dock-safe-right: env(safe-area-inset-right, 0px);
  --dock-safe-bottom: env(safe-area-inset-bottom, 0px);
  --dock-safe-left: env(safe-area-inset-left, 0px);
  position: fixed;
  z-index: 45;
  top: 50%;
  right: 0;
  color: #0e1421;
  font-family: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  transform: translateY(-42%);
}

.consultation-dock__toggle {
  display: none;
}

.consultation-dock__hint {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.consultation-dock__handle {
  display: flex;
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #7b818b;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #eceef2;
  font: inherit;
  font-size: 11px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.consultation-dock__handle:focus-visible {
  outline: 2px solid #0260f8;
  outline-offset: -3px;
}

.consultation-dock__panel {
  width: 116px;
  max-height: calc(100dvh - var(--header-height, 70px) - 24px);
  background: #fff;
  border: 1px solid #e4e7ed;
  border-right: 0;
  border-radius: var(--radius-container) 0 0 var(--radius-container);
  box-shadow: 0 8px 24px rgb(14 20 33 / 10%);
  overflow: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.consultation-dock__item {
  display: flex;
  width: 100%;
  min-height: 104px;
  padding: 14px 8px 12px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  color: #343b47;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #eceef2;
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease;
}

.consultation-dock__item:last-child {
  border-bottom: 0;
}

.consultation-dock__item:hover,
.consultation-dock__item:focus-visible {
  color: #0e1421;
  background: #f6f7f9;
  outline-offset: -3px;
}

.consultation-dock__icon {
  display: grid;
  width: 34px;
  height: 34px;
  margin-bottom: 8px;
  place-items: center;
}

.consultation-dock__icon img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.consultation-dock__item strong {
  font-size: 13px;
  font-weight: 600;
}

.consultation-dock__item small {
  margin-top: 3px;
  color: #8a909a;
  font-size: 10px;
  line-height: 1.4;
}

.consultation-dock__wechat {
  position: absolute;
  top: 204px;
  right: 130px;
  width: 176px;
  padding: 16px;
  background: #fff;
  border: 1px solid #e1e4ea;
  border-radius: var(--radius-container);
  box-shadow: 0 12px 30px rgb(14 20 33 / 14%);
  text-align: center;
}

.consultation-dock__wechat::after {
  position: absolute;
  top: 38px;
  right: -7px;
  width: 12px;
  height: 12px;
  content: "";
  background: #fff;
  border-top: 1px solid #e1e4ea;
  border-right: 1px solid #e1e4ea;
  transform: rotate(45deg);
}

.consultation-dock__wechat img {
  width: 142px;
  height: 142px;
  object-fit: cover;
}

.consultation-dock__wechat strong,
.consultation-dock__wechat small {
  display: block;
}

.consultation-dock__wechat strong {
  margin-top: 10px;
  font-size: 13px;
}

.consultation-dock__wechat small {
  margin-top: 3px;
  color: #7b818b;
  font-size: 10px;
}

/* Keep both shortcuts visible on desktop, with a narrower rail on small laptops. */
@media (max-width: 1399px) {
  .consultation-dock {
    top: 40%;
  }

  .consultation-dock__panel {
    width: 88px;
  }

  .consultation-dock__item {
    min-height: 96px;
    padding-inline: 6px;
  }
}

/* Only tablets and phones collapse the rail into the consultation button. */
@media (max-width: 1024px) {
  .consultation-dock {
    z-index: 60;
    top: auto;
    right: calc(16px + env(safe-area-inset-right, 0px));
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    transform: none;
  }

  .consultation-dock__toggle {
    display: grid;
    width: 54px;
    height: 54px;
    padding: 0;
    place-items: center;
    color: #fff;
    background: #1f5fff;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 8px 20px rgb(31 95 255 / 28%);
    cursor: pointer;
    touch-action: none;
    user-select: none;
  }

  .consultation-dock__handle {
    display: none;
  }

  .consultation-dock__toggle span {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
  }

  .consultation-dock__toggle strong {
    font-size: 10px;
    line-height: 1;
  }

  .consultation-dock__panel {
    position: absolute;
    right: 0;
    bottom: 66px;
    display: none;
    width: 244px;
    border-right: 1px solid #e4e7ed;
    border-radius: var(--radius-container);
  }

  .consultation-dock[data-dock-side="left"] .consultation-dock__panel {
    right: auto;
    left: 0;
  }

  .consultation-dock.opens-below .consultation-dock__panel {
    top: 66px;
    bottom: auto;
  }

  .consultation-dock__panel.is-open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .consultation-dock__item {
    min-height: 92px;
    padding: 12px 4px;
    border-right: 1px solid #eceef2;
    border-bottom: 0;
  }

  .consultation-dock__item:last-child {
    border-right: 0;
  }

  .consultation-dock__item small {
    display: none;
  }

  .consultation-dock__wechat {
    top: auto;
    right: 0;
    bottom: 168px;
  }

  .consultation-dock__wechat::after {
    top: auto;
    right: 24px;
    bottom: -7px;
    border: 0;
    border-right: 1px solid #e1e4ea;
    border-bottom: 1px solid #e1e4ea;
  }
}

.consultation-dock.is-positioned {
  top: 0;
  right: auto;
  bottom: auto;
  left: 0;
  transform: translate3d(var(--dock-x), var(--dock-y), 0);
}

.consultation-dock.is-positioned .consultation-dock__panel {
  border-right: 1px solid #e4e7ed;
  border-radius: var(--radius-container);
}

.consultation-dock.is-dragging .consultation-dock__handle,
.consultation-dock.is-dragging .consultation-dock__toggle {
  cursor: grabbing;
}

@media (prefers-reduced-motion: reduce) {
  .consultation-dock * {
    transition-duration: 0.01ms !important;
  }
}
