.chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  width: 56px;
  height: 56px;
  border: 1px solid var(--text);
  border-radius: 50%;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.chatbot-toggle:hover {
  background: var(--text);
  color: #ffffff;
}

.chatbot-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 1000;
  width: 360px;
  max-width: calc(100vw - 48px);
  height: 480px;
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
  border: 1px solid var(--text);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  min-height: 0;
}

.chatbot-panel[hidden] {
  display: none;
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}

.chatbot-title {
  font-size: 13px;
  letter-spacing: 0.04em;
}

.chatbot-close {
  border: none;
  background: none;
  font-family: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

.chatbot-messages {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.chatbot-message {
  max-width: 85%;
  min-width: 0;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.chatbot-message a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chatbot-message a:hover {
  opacity: 0.8;
}

.chatbot-message-bot {
  align-self: flex-start;
  background: #f5f5f5;
  border: 1px solid var(--rule);
}

.chatbot-message-user {
  align-self: flex-end;
  background: var(--text);
  color: #ffffff;
}

.chatbot-message-typing {
  align-self: flex-start;
  background: #f5f5f5;
  border: 1px solid var(--rule);
  opacity: 0.75;
  font-style: italic;
}

.chatbot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.chatbot-chip {
  font-family: inherit;
  font-size: 11px;
  line-height: 1.35;
  padding: 6px 10px;
  border: 1px solid var(--text);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  max-width: 100%;
}

.chatbot-chip:hover {
  background: var(--text);
  color: #ffffff;
}

.chatbot-input-area {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px;
  border-top: 1px solid var(--rule);
  flex-shrink: 0;
  background: #ffffff;
}

.chatbot-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--text);
  padding: 8px 10px;
  resize: none;
  min-height: 38px;
  max-height: 80px;
}

.chatbot-input:focus {
  outline: 1px solid var(--text);
  outline-offset: 1px;
}

.chatbot-send {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 14px;
  border: 1px solid var(--text);
  background: var(--text);
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  min-height: 38px;
}

.chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  body.chatbot-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }

  .chatbot-panel {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    height: 100dvh;
    border: none;
    border-top: 1px solid var(--text);
    box-shadow: none;
  }

  .chatbot-header {
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .chatbot-input-area {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .chatbot-input {
    font-size: 16px;
  }

  .chatbot-toggle {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  body.chatbot-open .chatbot-toggle {
    display: none;
  }
}
