.fka-root.fka-sidebar-active {
  top: var(--fka-sidebar-top);
  bottom: auto;
  width: var(--fka-sidebar-size);
  color: var(--fka-sidebar-text);
}

.fka-sidebar-active.fka-pos-right {
  right: var(--fka-side);
}

.fka-sidebar-active.fka-pos-left {
  left: var(--fka-side);
}

.fka-sidebar-active .fka-launcher,
.fka-sidebar-active .fka-cta {
  display: none !important;
}

.fka-sidebar-active .fka-channel-list {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: var(--fka-sidebar-size);
}

.fka-sidebar-active .fka-channel-list[hidden] {
  display: none;
}

.fka-sidebar-active .fka-channel + .fka-channel {
  margin-top: var(--fka-sidebar-gap);
}

.fka-sidebar-active .fka-channel {
  width: var(--fka-sidebar-size);
  min-width: var(--fka-sidebar-size);
  height: var(--fka-sidebar-size);
  min-height: var(--fka-sidebar-size);
  margin: 0;
  padding: 0;
  overflow: hidden;
  gap: 0;
  border: 0;
  border-radius: var(--fka-sidebar-radius);
  background: var(--fka-sidebar-item-bg, var(--fka-sidebar-bg));
  color: var(--fka-sidebar-text);
  box-shadow: 0 5px 16px rgba(0, 0, 0, .14);
  white-space: nowrap;
  transition: width .24s cubic-bezier(.2,.7,.2,1), background-color .2s, box-shadow .2s;
  animation: fka-sidebar-item-in .32s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: calc(var(--fka-index, 0) * 35ms);
}

.fka-sidebar-active.fka-pos-right .fka-channel {
  margin-left: auto;
  flex-direction: row-reverse;
}

.fka-sidebar-active.fka-pos-left .fka-channel {
  margin-right: auto;
  flex-direction: row;
}

.fka-sidebar-active .fka-channel:hover,
.fka-sidebar-active .fka-channel:focus-visible {
  width: var(--fka-sidebar-hover-width);
  background: var(--fka-sidebar-hover);
  color: var(--fka-sidebar-text);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .2);
  outline: none;
}

.fka-sidebar-active .fka-channel > span,
.fka-sidebar-active .fka-channel > img {
  flex: 0 0 var(--fka-sidebar-size);
  width: var(--fka-sidebar-size);
  height: var(--fka-sidebar-size);
  border-radius: var(--fka-sidebar-radius);
  background: transparent !important;
  box-shadow: none;
  color: inherit;
}

.fka-sidebar-active .fka-channel:hover > span,
.fka-sidebar-active .fka-channel:hover > img {
  transform: none;
  box-shadow: none;
}

.fka-sidebar-active .fka-channel em {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 16px;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: var(--fka-sidebar-size);
  text-align: center;
  opacity: 0;
  transition: opacity .14s ease .04s;
}

.fka-sidebar-active .fka-channel:hover em,
.fka-sidebar-active .fka-channel:focus-visible em {
  opacity: 1;
  transform: none;
}

.fka-sidebar-active .fka-sidebar-top {
  --fka-sidebar-item-bg: var(--fka-sidebar-bg);
  --fka-icon-size: 23px;
}

.fka-sidebar-active .fka-panel {
  top: calc((var(--fka-panel-height) - var(--fka-sidebar-size)) / -2);
  bottom: auto;
}

.fka-sidebar-active.fka-pos-right .fka-panel {
  right: calc(var(--fka-sidebar-size) + 14px);
}

.fka-sidebar-active.fka-pos-left .fka-panel {
  left: calc(var(--fka-sidebar-size) + 14px);
}

@keyframes fka-sidebar-item-in {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 782px) {
  .fka-root.fka-sidebar-active {
    top: var(--fka-sidebar-top);
    bottom: auto;
  }

  .fka-sidebar-active .fka-channel:hover,
  .fka-sidebar-active .fka-channel:focus-visible {
    width: min(var(--fka-sidebar-hover-width), calc(100vw - 24px));
  }

  .fka-sidebar-active .fka-panel {
    position: fixed;
    top: auto;
  }
}



/* Keep the outer edge fixed: right bars expand left, left bars expand right. */
.fka-sidebar-active .fka-channel {
  position: relative;
  left: 0;
  transition: width .24s cubic-bezier(.2,.7,.2,1), left .24s cubic-bezier(.2,.7,.2,1), background-color .2s, box-shadow .2s;
}

.fka-sidebar-active.fka-pos-right .fka-channel:hover,
.fka-sidebar-active.fka-pos-right .fka-channel:focus-visible {
  left: calc(var(--fka-sidebar-size) - var(--fka-sidebar-hover-width));
}

.fka-sidebar-active.fka-pos-left .fka-channel:hover,
.fka-sidebar-active.fka-pos-left .fka-channel:focus-visible {
  left: 0;
}

.fka-sidebar-qr {
  position: absolute;
  z-index: 4;
  width: 184px;
  padding: 12px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .2);
  color: #263a2d;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.fka-sidebar-qr[hidden] {
  display: none;
}

.fka-sidebar-active.fka-pos-right .fka-sidebar-qr {
  right: calc(var(--fka-sidebar-size) + 12px);
  transform: translateX(7px);
}

.fka-sidebar-active.fka-pos-left .fka-sidebar-qr {
  left: calc(var(--fka-sidebar-size) + 12px);
  transform: translateX(-7px);
}

.fka-sidebar-active .fka-sidebar-qr-visible {
  opacity: 1;
  transform: translateX(0);
}

.fka-sidebar-qr img {
  display: block;
  width: 160px;
  height: 160px;
  margin: 0 auto 8px;
  object-fit: contain;
}

.fka-sidebar-qr strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* QR channels reveal the QR card instead of opening a text capsule. */
.fka-sidebar-active .fka-channel-wechat:hover,
.fka-sidebar-active .fka-channel-wechat:focus-visible {
  width: var(--fka-sidebar-size);
}

.fka-sidebar-active.fka-pos-right .fka-channel-wechat:hover,
.fka-sidebar-active.fka-pos-right .fka-channel-wechat:focus-visible {
  left: 0;
}

.fka-sidebar-active .fka-channel-wechat:hover em,
.fka-sidebar-active .fka-channel-wechat:focus-visible em {
  opacity: 0;
}

@media (max-width: 782px) {
  .fka-sidebar-active.fka-pos-right .fka-channel:not(.fka-channel-wechat):hover,
  .fka-sidebar-active.fka-pos-right .fka-channel:not(.fka-channel-wechat):focus-visible {
    left: calc(var(--fka-sidebar-size) - min(var(--fka-sidebar-hover-width), calc(100vw - 24px)));
  }
}
/* Reference order is always icon first, followed by the label. */
.fka-sidebar-active.fka-pos-right .fka-channel,
.fka-sidebar-active.fka-pos-left .fka-channel {
  flex-direction: row;
}

/* Keep each channel's configured icon color; sidebar text uses its own color. */
.fka-sidebar-active .fka-channel > span {
  color: var(--fka-icon-color, #fff);
}

.fka-root.fka-sidebar-active {
  visibility: hidden;
  opacity: 0;
  transition: opacity .3s ease, visibility 0s linear .3s;
}

.fka-root.fka-sidebar-active.fka-sidebar-visible {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

.fka-sidebar-active .fka-sidebar-top {
  display: none;
}

.fka-sidebar-active .fka-sidebar-top-visible {
  display: flex;
}

@media (prefers-reduced-motion: reduce) {
  .fka-root.fka-sidebar-active {
    transition-duration: .01ms;
  }
}
/* Scroll-triggered enterprise sidebar entrance. */
.fka-root.fka-sidebar-active {
  transition: opacity var(--fka-sidebar-hide-duration,250ms) ease, transform var(--fka-sidebar-hide-duration,250ms) cubic-bezier(.2,.7,.2,1), visibility 0s linear var(--fka-sidebar-hide-duration,250ms);
}

.fka-root.fka-sidebar-active.fka-pos-right {
  transform: translateX(14px);
}

.fka-root.fka-sidebar-active.fka-pos-left {
  transform: translateX(-14px);
}

.fka-root.fka-sidebar-active.fka-sidebar-visible {
  transform: translateX(0);
  transition: opacity var(--fka-sidebar-show-duration,300ms) ease, transform var(--fka-sidebar-show-duration,300ms) cubic-bezier(.2,.7,.2,1), visibility 0s linear 0s;
}

@media (prefers-reduced-motion: reduce) {
  .fka-root.fka-sidebar-active {
    transition-duration: .01ms;
  }
}
/* Mobile sidebar panels must be positioned against the viewport, not the transformed sidebar root. */
@media (max-width: 782px) {
  .fka-root.fka-sidebar-active.fka-sidebar-visible {
    transform: none;
  }

  .fka-sidebar-active .fka-panel,
  .fka-sidebar-active.fka-pos-right .fka-panel,
  .fka-sidebar-active.fka-pos-left .fka-panel {
    position: fixed;
    top: 24px !important;
    right: 16px !important;
    bottom: 24px !important;
    left: 16px !important;
    top: max(24px, env(safe-area-inset-top)) !important;
    right: max(16px, env(safe-area-inset-right)) !important;
    bottom: max(24px, env(safe-area-inset-bottom)) !important;
    left: max(16px, env(safe-area-inset-left)) !important;
    width: auto;
    max-width: 420px;
    height: auto;
    max-height: 680px;
    margin: auto;
    border-radius: 14px;
  }
}
.fka-sidebar-active .fka-sidebar-top > img {
  box-sizing: border-box;
  padding: calc((var(--fka-sidebar-size) - var(--fka-icon-size,23px)) / 2);
  object-fit: contain;
}
/* Let the fixed WeChat modal use the browser viewport on desktop sidebar layouts. */
.fka-root.fka-sidebar-active.fka-modal-open {
  transform: none !important;
}

/* Mobile classic/capsule fallback: keep Back to Top independent from contact channels. */
.fka-mobile-capsule-top {
  position: absolute;
  right: 0;
  z-index: 3;
  display: flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fka-mobile-top-bg, #01304a);
  color: var(--fka-icon-color, #fff);
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
  transition: bottom .24s cubic-bezier(.2,.7,.2,1), opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
.fka-pos-left .fka-mobile-capsule-top { left: 0; right: auto; }
.fka-mobile-capsule-top-visible { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; transition-delay: 0s; }
.fka-mobile-capsule-top > span,
.fka-mobile-capsule-top > img { display: flex; width: var(--fka-icon-size,23px); height: var(--fka-icon-size,23px); align-items: center; justify-content: center; object-fit: contain; font-size: var(--fka-icon-size,23px); }
.fka-mobile-capsule-top .fka-svg-mask { width: 100%; height: 100%; background-color: currentColor; }
@media (min-width: 783px) {
  .fka-mobile-capsule-top { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .fka-mobile-capsule-top { transition-duration: .01ms; }
}
