#kc-chat-button {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2147483000;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font: 600 14px/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

#kc-chat-panel {
  position: fixed;
  right: 16px;
  bottom: 72px;
  z-index: 2147483000;
  width: 320px;
  max-width: calc(100vw - 24px);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111;
  overflow: hidden;
}

.kc-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #111;
  color: #fff;
  font-weight: 700;
}

.kc-chat-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.kc-chat-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kc-chat-notice {
  margin: 0;
  font-size: 12px;
  color: #555;
}

.kc-chat-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  margin: 0;
}

.kc-chat-categories {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kc-chat-category {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.kc-chat-category--selected {
  border-color: #111;
  background: #f0f0f0;
  font-weight: 600;
}

.kc-chat-input,
.kc-chat-textarea {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  resize: vertical;
}

.kc-chat-error {
  margin: 0;
  color: #8a0018;
  font-size: 12px;
}

.kc-chat-send {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: #111;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.kc-chat-send:disabled {
  opacity: 0.6;
  cursor: default;
}

.kc-chat-body--thread {
  padding: 0;
  flex: 1;
  min-height: 0;
}

.kc-chat-messages {
  flex: 1;
  min-height: 180px;
  max-height: 320px;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kc-chat-message {
  max-width: 85%;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f0f0f0;
}

.kc-chat-message--customer {
  align-self: flex-end;
  background: #111;
  color: #fff;
}

.kc-chat-message--staff {
  align-self: flex-start;
  background: #f0f0f0;
}

.kc-chat-message--system {
  align-self: center;
  background: transparent;
  color: #777;
  font-size: 12px;
  font-style: italic;
  text-align: center;
}

.kc-chat-message-sender {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 2px;
}

.kc-chat-message-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.kc-chat-message-body a {
  color: inherit;
  text-decoration: underline;
}

.kc-chat-reply {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #eee;
}

.kc-chat-reply .kc-chat-textarea {
  flex: 1;
  resize: none;
}

.kc-chat-banner {
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.kc-chat-banner--closed {
  background: #fff4f4;
  color: #8a0018;
}

.kc-chat-banner--busy {
  background: #fff8e6;
  color: #6a4d00;
}

.kc-chat-body--thread .kc-chat-banner {
  margin: 10px 14px 0;
}

.kc-chat-urgent {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 400;
  margin: 0;
}

.kc-chat-body--thread .kc-chat-urgent {
  margin: 0 14px;
}

@media (max-width: 640px) {
  #kc-chat-button {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }

  #kc-chat-panel {
    right: 12px;
    left: 12px;
    bottom: 70px;
    width: auto;
  }
}
