/* Botones flotantes apilados — esquina inferior derecha */
.tpda-fab-stack {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  z-index: 9990;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.tpda-fab-stack > * {
  pointer-events: auto;
}

.tpda-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  font-size: 1.35rem;
  color: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.tpda-fab:hover {
  transform: scale(1.06);
}

.tpda-fab--wa {
  background: #25d366;
  font-size: 1.55rem;
}

.tpda-fab--wa:hover {
  box-shadow: 0 6px 22px rgba(37, 211, 102, 0.45);
}

.tpda-fab--chat {
  background: var(--dr-terracotta, #cd734f);
  font-size: 1.45rem;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(205, 115, 79, 0.35);
}

.tpda-fab--chat:hover {
  box-shadow: 0 6px 22px rgba(205, 115, 79, 0.45);
}

/* Chat panel — encima del stack */
#cb-box {
  display: none;
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(max(16px, env(safe-area-inset-bottom, 0px)) + var(--tpda-fab-stack-h, 188px));
  z-index: 9989;
  width: min(320px, calc(100vw - 32px));
  background: #262522;
  border: 1px solid rgba(237, 183, 129, 0.28);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 576px) {
  .tpda-fab {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
  }

  #cb-box {
    right: 12px;
    bottom: calc(12px + var(--tpda-fab-stack-h, 172px));
  }

  body.page-dashboard .tpda-fab-stack {
    transform: scale(0.86);
    transform-origin: bottom right;
    opacity: 0.92;
  }
}
