.sw-public-chat {
  position: fixed;
  right: 0.9rem;
  top: calc(50% + 1.6rem);
  transform: translateY(-50%);
  z-index: 1041;
  font-family: var(--font-body, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  box-sizing: border-box;
}

.sw-public-chat *,
.sw-public-chat *::before,
.sw-public-chat *::after {
  box-sizing: border-box;
}

.sw-public-chat--solo {
  right: 0.9rem;
  top: 50%;
}

.sw-public-chat__launcher,
.sw-public-chat__form button {
  border: 1px solid var(--brand-button-primary-border, var(--brand-primary, #0d6efd));
  background: var(--brand-button-primary-bg, var(--brand-primary, #0d6efd));
  color: var(--brand-button-primary-text, #111);
  border-radius: var(--brand-button-radius, 999px);
  font-weight: 700;
  box-shadow: var(--brand-shadow-md, 0 14px 34px rgba(0, 0, 0, 0.16));
}

.sw-public-chat__launcher {
  width: 2.55rem;
  height: 2.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.sw-public-chat__launcher:hover,
.sw-public-chat__launcher:focus {
  outline: 0;
  border-color: var(--brand-primary);
  background: var(--brand-primary-soft, var(--brand-primary, #0d6efd));
  color: var(--brand-primary, currentColor);
}

.sw-public-chat__launcher svg {
  width: 1.18rem;
  height: 1.18rem;
  display: block;
  stroke: currentColor;
}

.sw-public-chat__launcher-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sw-public-chat__panel {
  position: fixed;
  right: 1rem;
  top: 50%;
  width: min(420px, calc(100vw - 2rem));
  max-height: min(650px, calc(100dvh - 2rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(-50%);
  border: 1px solid var(--brand-card-border, rgba(0, 0, 0, 0.12));
  border-radius: var(--brand-card-radius, 16px);
  background: var(--brand-card-bg, #fff);
  color: var(--brand-body-text, #111);
  box-shadow: var(--brand-shadow-lg, 0 24px 54px rgba(0, 0, 0, 0.22));
}

.sw-public-chat--fullscreen {
  inset: 0;
  right: auto;
  top: auto;
  transform: none;
  z-index: 1055;
}

.sw-public-chat--fullscreen .sw-public-chat__launcher {
  display: none;
}

.sw-public-chat--fullscreen .sw-public-chat__panel {
  inset: 1rem;
  right: 1rem;
  top: 1rem;
  width: auto;
  max-height: none;
  transform: none;
}

.sw-public-chat__panel[hidden] {
  display: none !important;
}

.sw-public-chat__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--brand-card-border, rgba(0, 0, 0, 0.12));
}

.sw-public-chat__header strong {
  display: block;
  color: var(--brand-heading-text, currentColor);
  font-size: 1rem;
}

.sw-public-chat__header > div {
  min-width: 0;
  flex: 1 1 auto;
}

.sw-public-chat__maximize,
.sw-public-chat__close {
  border: 0;
  background: transparent;
  color: inherit;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.sw-public-chat__maximize {
  font-size: 1rem;
}

.sw-public-chat__messages {
  min-height: 0;
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.65rem;
}

.sw-public-chat__message {
  max-width: 88%;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 0.92rem;
}

.sw-public-chat__message--assistant {
  align-self: flex-start;
  background: var(--brand-secondary-soft, rgba(0, 0, 0, 0.06));
  color: var(--brand-body-text, #111);
}

.sw-public-chat__message--visitor {
  align-self: flex-end;
  background: var(--brand-primary, #0d6efd);
  color: var(--brand-primary-contrast, #fff);
}

.sw-public-chat__status {
  padding: 0 1rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--brand-muted-text, #667085);
}

.sw-public-chat__whatsapp {
  align-self: flex-start;
  color: var(--brand-link, var(--brand-primary, #0d6efd));
  font-weight: 700;
  font-size: 0.9rem;
}

.sw-public-chat__form {
  padding: 0.85rem 1rem 1rem;
  display: grid;
  gap: 0.65rem;
  flex: 0 0 auto;
  max-height: min(42dvh, 20rem);
  overflow: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--brand-card-border, rgba(0, 0, 0, 0.12));
}

.sw-public-chat__fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.sw-public-chat__fields[hidden] {
  display: none !important;
}

.sw-public-chat__model {
  display: grid;
  grid-template-columns: minmax(4.5rem, auto) 1fr;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-muted-text, var(--brand-body-text, #111));
}

.sw-public-chat__model[hidden] {
  display: none !important;
}

.sw-public-chat__form input,
.sw-public-chat__form textarea,
.sw-public-chat__form select {
  width: 100%;
  border: 1px solid var(--brand-input-border, rgba(0, 0, 0, 0.2));
  background: var(--brand-input-bg, #fff);
  color: var(--brand-input-text, #111);
  border-radius: var(--brand-input-radius, 10px);
  padding: 0.7rem 0.8rem;
  font: inherit;
}

.sw-public-chat__form textarea {
  min-height: 5.2rem;
  resize: vertical;
}

.sw-public-chat__form button {
  padding: 0.75rem 1rem;
  cursor: pointer;
}

.sw-public-chat__form button[disabled] {
  opacity: 0.7;
  cursor: wait;
}

@media (max-width: 575.98px) {
  .sw-public-chat {
    right: 0.5rem;
    top: calc(50% + 1.5rem);
  }

  .sw-public-chat--solo {
    right: 0.5rem;
    top: 50%;
  }

  .sw-public-chat__panel {
    right: 0.5rem;
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
  }

  .sw-public-chat--fullscreen .sw-public-chat__panel {
    inset: 0.5rem;
    width: auto;
  }

  .sw-public-chat__model {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}
