.web-chat {
  position: fixed;
  z-index: 90;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  display: grid;
  justify-items: end;
  gap: .75rem;
}

.web-chat__launcher,
.web-chat__form button {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(105deg, var(--brand-primary), var(--brand-secondary));
  box-shadow: 0 14px 34px rgba(35, 124, 128, .24);
  color: var(--surface-page);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.web-chat__launcher {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  padding: 0 1.1rem;
}

.web-chat__launcher img {
  width: 30px;
  height: auto;
  filter: brightness(0) invert(1);
}

.web-chat__panel {
  width: min(400px, calc(100vw - 2rem));
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: 16px;
  background: var(--surface-elevated);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
}

.web-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--border-default);
}

.web-chat__header div {
  display: grid;
  gap: .2rem;
}

.web-chat__header span {
  color: var(--text-muted);
  font-size: .72rem;
}

.web-chat__header button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.6rem;
}

.web-chat__messages {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  max-height: min(48vh, 390px);
  min-height: 180px;
  overflow-y: auto;
  padding: 1rem;
}

.web-chat__message {
  max-width: 88%;
  margin: 0;
  padding: .72rem .86rem;
  border-radius: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.web-chat__message--bot {
  align-self: flex-start;
  border: 1px solid var(--border-default);
  background: var(--surface-secondary);
  color: var(--text-primary);
}

.web-chat__message--user {
  align-self: flex-end;
  background: var(--brand-secondary);
  color: #fff;
}

.web-chat__handover {
  margin: 0 1rem .75rem;
  padding: .75rem;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--surface-secondary);
}

.web-chat__handover p {
  margin: 0 0 .25rem;
}

.web-chat__handover a {
  color: var(--brand-primary);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: .18em;
}

.web-chat__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .55rem;
  padding: .8rem 1rem;
  border-top: 1px solid var(--border-default);
}

.web-chat__form textarea {
  min-height: 52px;
  max-height: 120px;
  resize: vertical;
  padding: .65rem .75rem;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--surface-primary);
  color: var(--text-primary);
  font: inherit;
}

.web-chat__form button {
  align-self: end;
  padding: 0 .95rem;
  border-radius: 10px;
}

.web-chat__form button:disabled {
  cursor: wait;
  opacity: .62;
}

.web-chat__status,
.web-chat__privacy {
  margin: 0;
  padding: 0 1rem .75rem;
  color: var(--text-muted);
  font-size: .72rem;
  line-height: 1.45;
}

.web-chat__status:not(:empty) {
  color: #c13d47;
}

.web-chat__privacy a {
  text-decoration: underline;
  text-underline-offset: .16em;
}

@media (max-width: 520px) {
  .web-chat {
    right: .75rem;
    bottom: .75rem;
  }

  .web-chat__panel {
    width: calc(100vw - 1.5rem);
    max-height: calc(100vh - 6rem);
  }

  .web-chat__messages {
    max-height: calc(100vh - 23rem);
    min-height: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .web-chat *,
  .web-chat *::before,
  .web-chat *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
