:root {
  --kwc-accent: #0f766e;
  --kwc-accent-dark: #115e59;
  --kwc-line: #d8dee8;
  --kwc-muted: #64748b;
  --kwc-shadow: 0 22px 60px rgba(15, 23, 42, 0.18);
}

.kwc-chat-widget,
.kwc-chat-widget * {
  box-sizing: border-box;
}

.kwc-chat-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999999;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2937;
}

.kwc-chat-widget button,
.kwc-chat-widget input {
  font: inherit;
}

.kwc-chat-launcher {
  min-width: 122px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: var(--kwc-accent);
  box-shadow: var(--kwc-shadow);
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
}

.kwc-launcher-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.kwc-launcher-icon svg {
  width: 28px;
  height: 28px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kwc-launcher-text {
  font-size: 1.1rem;
  line-height: 1;
}

.kwc-chat-window {
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 112px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid var(--kwc-line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--kwc-shadow);
}

.kwc-chat-window[hidden] {
  display: none;
}

.kwc-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  color: #ffffff;
  background: var(--kwc-accent-dark);
}

.kwc-chat-header p {
  margin: 0;
  color: inherit;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
}

.kwc-chat-header span {
  display: block;
  margin-top: 3px;
  color: inherit;
  font-size: 0.8rem;
  line-height: 1.3;
  opacity: 0.82;
}

.kwc-chat-header button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.kwc-chat-messages {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
  text-align: left !important;
}

.kwc-chat-widget .kwc-chat-messages .kwc-message {
  width: auto !important;
  inline-size: auto !important;
  min-width: 0 !important;
  max-width: 84%;
  padding: 11px 13px;
  border-radius: 8px;
  color: #1f2937;
  font-size: 0.95rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  display: table !important;
  text-align: left !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
  place-items: initial !important;
  justify-items: start !important;
}

.kwc-chat-widget .kwc-chat-messages [data-kwc-greeting] {
  display: table !important;
  width: auto !important;
  inline-size: auto !important;
  max-width: 84% !important;
  margin-right: auto !important;
  margin-left: 0 !important;
  text-align: left !important;
}

.kwc-chat-widget .kwc-chat-messages .kwc-message,
.kwc-chat-widget .kwc-chat-messages .kwc-message * {
  text-align: left !important;
}

.kwc-chat-widget .kwc-chat-messages .kwc-message .kwc-message-text {
  display: block !important;
  width: auto !important;
  text-align: left !important;
}

.kwc-chat-widget .kwc-message-bot {
  align-self: flex-start;
  margin-right: auto !important;
  border: 1px solid var(--kwc-line);
  background: #ffffff;
}

.kwc-chat-widget .kwc-message-user {
  align-self: flex-end;
  margin-left: auto !important;
  color: #ffffff !important;
  background: var(--kwc-accent);
}

.kwc-chat-widget .kwc-message-loading {
  color: var(--kwc-muted);
}

.kwc-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--kwc-line);
  background: #ffffff;
}

.kwc-chat-form input {
  min-width: 0;
  height: 44px;
  border: 1px solid var(--kwc-line);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
  color: #1f2937;
  background: #ffffff;
}

.kwc-chat-form input:focus {
  border-color: var(--kwc-accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.kwc-chat-form button {
  min-width: 76px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: var(--kwc-accent);
  cursor: pointer;
  font-weight: 800;
}

.kwc-chat-form button:disabled,
.kwc-chat-form input:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  .kwc-chat-widget {
    right: 14px;
    bottom: 14px;
  }

  .kwc-chat-window {
    width: calc(100vw - 28px);
    height: calc(100vh - 92px);
  }

  .kwc-chat-launcher {
    min-width: 118px;
  }
}
