.hws-chat-root {
  --hws-chat-navy: #1b2a4a;
  --hws-chat-teal: #1e7c6b;
  --hws-chat-white: #ffffff;
  --hws-chat-ink: #152033;
  --hws-chat-muted: #607086;
  --hws-chat-border: #dce4ea;
  --hws-chat-bg: #f7fafb;
  --hws-chat-shadow: 0 18px 48px rgba(16, 32, 57, 0.22);
  bottom: max(20px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  color: var(--hws-chat-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  z-index: 999999;
}

.hws-chat-root *,
.hws-chat-root *::before,
.hws-chat-root *::after {
  box-sizing: border-box;
}

.hws-chat-launcher {
  align-items: center;
  background: var(--hws-chat-navy);
  border: 0;
  border-radius: 999px;
  box-shadow: var(--hws-chat-shadow);
  color: var(--hws-chat-white);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  gap: 10px;
  min-height: 56px;
  min-width: 56px;
  padding: 0 18px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.hws-chat-launcher-dot {
  background: var(--hws-chat-teal);
  border: 2px solid var(--hws-chat-white);
  border-radius: 50%;
  display: inline-block;
  height: 12px;
  width: 12px;
}

.hws-chat-launcher:hover {
  background: #24385f;
  transform: translateY(-1px);
}

.hws-chat-launcher:focus-visible,
.hws-chat-panel button:focus-visible,
.hws-chat-panel input:focus-visible,
.hws-chat-panel textarea:focus-visible,
.hws-chat-panel select:focus-visible {
  outline: 3px solid rgba(30, 124, 107, 0.35);
  outline-offset: 3px;
}

.hws-chat-panel {
  background: var(--hws-chat-white);
  border: 1px solid rgba(27, 42, 74, 0.14);
  border-radius: 8px;
  bottom: 76px;
  box-shadow: var(--hws-chat-shadow);
  display: flex;
  flex-direction: column;
  height: min(680px, calc(100vh - 112px));
  overflow: hidden;
  position: absolute;
  right: 0;
  width: min(392px, calc(100vw - 32px));
}

.hws-chat-panel[hidden],
.hws-chat-launcher[hidden] {
  display: none;
}

.hws-chat-header {
  align-items: center;
  background: var(--hws-chat-navy);
  color: var(--hws-chat-white);
  display: flex;
  gap: 12px;
  min-height: 64px;
  padding: 14px 16px;
}

.hws-chat-mark {
  align-items: center;
  background: var(--hws-chat-teal);
  border-radius: 50%;
  display: inline-flex;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.hws-chat-logo {
  background: var(--hws-chat-white);
  border-radius: 8px;
  flex: 0 0 auto;
  height: 40px;
  object-fit: contain;
  padding: 4px;
  width: 40px;
}

.hws-chat-launcher-logo {
  background: var(--hws-chat-white);
  border-radius: 50%;
  height: 28px;
  object-fit: contain;
  padding: 3px;
  width: 28px;
}

.hws-chat-title {
  flex: 1;
  min-width: 0;
}

.hws-chat-title strong,
.hws-chat-title span {
  display: block;
  line-height: 1.25;
}

.hws-chat-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hws-chat-title span {
  display: none;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.hws-chat-icon-button {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  border-radius: 8px;
  color: var(--hws-chat-white);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 18px;
  height: 44px;
  justify-content: center;
  padding: 0;
  width: 44px;
}

.hws-chat-log {
  background: var(--hws-chat-bg);
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 16px;
  scroll-behavior: smooth;
}

.hws-chat-message {
  border-radius: 8px;
  line-height: 1.45;
  max-width: 86%;
  overflow-wrap: anywhere;
  padding: 11px 12px;
  white-space: pre-wrap;
}

.hws-chat-message--assistant {
  align-self: flex-start;
  background: var(--hws-chat-white);
  border: 1px solid var(--hws-chat-border);
}

.hws-chat-message--user {
  align-self: flex-end;
  background: var(--hws-chat-teal);
  color: var(--hws-chat-white);
}

.hws-chat-sources {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.hws-chat-sources a {
  color: var(--hws-chat-teal);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
}

.hws-chat-quick-replies,
.hws-chat-form-actions {
  background: var(--hws-chat-white);
  border-top: 1px solid var(--hws-chat-border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
}

.hws-chat-quick-replies--inline {
  align-self: flex-start;
  background: transparent;
  border-top: 0;
  max-width: 100%;
  padding: 0;
}

.hws-chat-chip,
.hws-chat-secondary {
  background: var(--hws-chat-white);
  border: 1px solid var(--hws-chat-border);
  border-radius: 999px;
  color: var(--hws-chat-navy);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  min-height: 38px;
  padding: 8px 12px;
}

.hws-chat-chip:hover,
.hws-chat-secondary:hover {
  border-color: var(--hws-chat-teal);
}

.hws-chat-form {
  background: var(--hws-chat-white);
  border-top: 1px solid var(--hws-chat-border);
  display: grid;
  gap: 10px;
  max-height: 48vh;
  overflow-y: auto;
  padding: 14px;
}

.hws-chat-form--inline {
  align-self: stretch;
  border: 1px solid var(--hws-chat-border);
  border-radius: 8px;
  max-height: none;
  overflow: visible;
}

.hws-chat-form-note,
.hws-chat-form-error {
  font-size: 12px;
  line-height: 1.35;
  margin: 0;
}

.hws-chat-form-note {
  color: var(--hws-chat-muted);
}

.hws-chat-form-error {
  color: #9f1d1d;
  font-weight: 700;
}

.hws-chat-field {
  display: grid;
  gap: 5px;
}

.hws-chat-field label {
  color: var(--hws-chat-navy);
  font-size: 13px;
  font-weight: 700;
}

.hws-chat-field input,
.hws-chat-field textarea,
.hws-chat-field select,
.hws-chat-composer textarea {
  background: var(--hws-chat-white);
  border: 1px solid var(--hws-chat-border);
  border-radius: 8px;
  color: var(--hws-chat-ink);
  font: inherit;
  font-size: 15px;
  min-height: 44px;
  padding: 10px 11px;
  width: 100%;
}

.hws-chat-field textarea,
.hws-chat-composer textarea {
  resize: vertical;
}

.hws-chat-checkbox {
  align-items: flex-start;
  display: flex;
  gap: 8px;
}

.hws-chat-checkbox input {
  margin-top: 3px;
  min-height: auto;
  width: auto;
}

.hws-chat-primary {
  background: var(--hws-chat-teal);
  border: 0;
  border-radius: 8px;
  color: var(--hws-chat-white);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 44px;
  padding: 10px 14px;
}

.hws-chat-primary:disabled,
.hws-chat-composer button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.hws-chat-composer {
  background: var(--hws-chat-white);
  border-top: 1px solid var(--hws-chat-border);
  display: grid;
  gap: 8px;
  padding: 12px 14px;
}

.hws-chat-composer-row {
  align-items: flex-end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.hws-chat-composer textarea {
  max-height: 132px;
  min-height: 48px;
}

.hws-chat-composer button {
  background: var(--hws-chat-navy);
  border: 0;
  border-radius: 8px;
  color: var(--hws-chat-white);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 48px;
  padding: 0 16px;
}

.hws-chat-privacy {
  color: var(--hws-chat-muted);
  font-size: 11px;
  line-height: 1.35;
}

.hws-chat-privacy a {
  color: var(--hws-chat-teal);
  font-weight: 700;
}

.hws-chat-typing {
  align-self: flex-start;
  color: var(--hws-chat-muted);
  font-size: 13px;
  padding: 0 4px;
}

@media (max-width: 520px) {
  .hws-chat-root {
    bottom: max(16px, env(safe-area-inset-bottom));
    left: auto;
    right: max(12px, env(safe-area-inset-right));
  }

  .hws-chat-launcher {
    justify-content: center;
    min-height: 52px;
    padding: 0 16px;
    width: auto;
  }

  .hws-chat-panel {
    bottom: 68px;
    height: min(520px, calc(100vh - 140px));
    right: 0;
    width: min(340px, calc(100vw - 24px));
  }

  .hws-chat-log {
    padding: 12px;
  }

  .hws-chat-form--inline {
    gap: 8px;
    padding: 10px;
  }

  .hws-chat-field input,
  .hws-chat-field textarea,
  .hws-chat-field select,
  .hws-chat-composer textarea {
    font-size: 14px;
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hws-chat-launcher,
  .hws-chat-log {
    scroll-behavior: auto;
    transition: none;
  }
}
