.bsc-chat {
  position: fixed;
  right: 1.15rem;
  bottom: 1.15rem;
  z-index: 9999;
  font-family: var(--font-body);
}

.bsc-chat-toggle {
  appearance: none;
  min-height: 3.35rem;
  padding: 0 1.05rem 0 0.9rem;
  border: 0;
  border-radius: 999px;
  background: var(--sage-deep);
  color: #f8fbf8;
  box-shadow: 0 10px 28px rgba(44, 53, 48, 0.22);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
}

.bsc-chat-toggle:hover {
  background: #3f6a54;
}

.bsc-chat-toggle svg {
  width: 1.45rem;
  height: 1.45rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bsc-chat-panel {
  position: absolute;
  right: 0;
  bottom: 4.35rem;
  width: min(22.5rem, calc(100vw - 2rem));
  height: min(32.5rem, calc(100vh - 7rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  box-shadow: 0 18px 50px rgba(44, 53, 48, 0.18);
}

.bsc-chat-panel[hidden] {
  display: none !important;
}

.bsc-chat-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 0.9rem;
  background: var(--sage-deep);
  color: #f8fbf8;
}

.bsc-chat-head img {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  background: #fff;
  object-fit: cover;
}

.bsc-chat-head strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
}

.bsc-chat-head span {
  display: block;
  font-size: 0.75rem;
  opacity: 0.86;
}

.bsc-chat-close {
  appearance: none;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

.bsc-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 0.85rem 0.35rem;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.bsc-chat-bubble {
  max-width: 86%;
  padding: 0.65rem 0.8rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.bsc-chat-bubble.is-bot {
  align-self: flex-start;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 0.3rem;
}

.bsc-chat-bubble.is-user {
  align-self: flex-end;
  background: var(--sage-deep);
  color: #f8fbf8;
  border-bottom-right-radius: 0.3rem;
}

.bsc-chat-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 0.28rem;
  padding: 0.7rem 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1rem;
}

.bsc-chat-typing i {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 999px;
  background: var(--ink-soft);
  opacity: 0.45;
  animation: bsc-chat-dot 1s ease-in-out infinite;
}

.bsc-chat-typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.bsc-chat-typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bsc-chat-dot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-3px);
    opacity: 0.9;
  }
}

.bsc-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem 0.55rem;
  background: var(--paper);
}

.bsc-chat-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.bsc-chat-chip:hover {
  border-color: var(--sage-deep);
  color: var(--sage-deep);
}

.bsc-chat-form {
  display: flex;
  gap: 0.45rem;
  padding: 0.7rem 0.75rem 0.8rem;
  background: #fff;
  border-top: 1px solid var(--line);
}

.bsc-chat-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper);
}

.bsc-chat-form input:focus {
  outline: 2px solid rgba(79, 125, 100, 0.35);
  border-color: var(--sage-deep);
}

.bsc-chat-form button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--sage-deep);
  color: #f8fbf8;
  padding: 0 0.95rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.bsc-chat-form button:hover {
  background: #3f6a54;
}

@media (max-width: 760px) {
  .bsc-chat {
    right: 0.85rem;
    bottom: 0.85rem;
  }

  .bsc-chat-panel {
    width: min(22.5rem, calc(100vw - 1.5rem));
    height: min(70vh, calc(100vh - 6.5rem));
  }
}
