.gnx-custom-chat {
  --gnx-chat-bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
  position: fixed;
  right: 22px;
  bottom: var(--gnx-chat-bottom);
  z-index: 2147483010;
  width: auto;
  display: grid;
  justify-items: end;
  color: #1f2933;
  font-family: Inter, Manrope, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  pointer-events: none;
}

.gnx-custom-chat * {
  box-sizing: border-box;
}

.gnx-custom-chat__launcher {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: #0f766e;
  color: #fff;
  box-shadow: 0 18px 42px rgba(15, 118, 110, 0.32);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.gnx-custom-chat__launcher:hover {
  background: #115e59;
  box-shadow: 0 22px 52px rgba(15, 118, 110, 0.38);
  transform: translateY(-2px);
}

.gnx-custom-chat__launcher:focus-visible {
  outline: 3px solid rgba(20, 184, 166, 0.42);
  outline-offset: 4px;
}

.gnx-custom-chat__mark {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.gnx-custom-chat__mark svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.gnx-custom-chat__panel {
  position: absolute;
  right: 0;
  bottom: 82px;
  width: min(430px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 112px));
  display: grid;
  grid-template-rows: auto minmax(150px, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.gnx-custom-chat.is-open .gnx-custom-chat__panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.gnx-custom-chat.is-open .gnx-custom-chat__launcher {
  opacity: 0;
  pointer-events: none;
}

.gnx-custom-chat__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 12px;
  padding: 18px;
  background: #eefdf9;
  border-bottom: 1px solid rgba(15, 118, 110, 0.14);
}

.gnx-custom-chat__header h2,
.gnx-custom-chat__header p {
  margin: 0;
}

.gnx-custom-chat__header h2 {
  margin-top: 5px;
  color: #0f172a;
  font-size: 1.08rem;
  line-height: 1.15;
}

.gnx-custom-chat__header p {
  margin-top: 5px;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.35;
}

.gnx-custom-chat__close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.gnx-custom-chat__messages {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 15px;
  overflow: auto;
  background: #f8fafc;
}

.gnx-custom-chat__message {
  max-width: 86%;
  display: grid;
  gap: 4px;
}

.gnx-custom-chat__message small {
  color: #64748b;
  font-size: 0.74rem;
}

.gnx-custom-chat__message p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.36;
}

.gnx-custom-chat__message.is-agent p {
  background: #e2e8f0;
  color: #0f172a;
}

.gnx-custom-chat__message.is-visitor {
  justify-self: end;
}

.gnx-custom-chat__message.is-visitor small {
  text-align: right;
}

.gnx-custom-chat__message.is-visitor p {
  background: #0f766e;
  color: #fff;
}

.gnx-custom-chat__form {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
}

.gnx-custom-chat__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.gnx-custom-chat__contact-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.gnx-custom-chat:not(.is-after-hours) .gnx-custom-chat__contact-fields {
  display: none;
}

.gnx-custom-chat__field {
  display: grid;
  gap: 4px;
}

.gnx-custom-chat__field label {
  color: #475569;
  font-size: 0.78rem;
  font-weight: 800;
}

.gnx-custom-chat__form input,
.gnx-custom-chat__form textarea {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 8px;
  padding: 10px;
  color: #0f172a;
  background: #fff;
  font: inherit;
}

.gnx-custom-chat__form textarea {
  min-height: 74px;
  resize: vertical;
}

.gnx-custom-chat__form button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.gnx-custom-chat__form.is-sending button {
  opacity: 0.7;
  pointer-events: none;
}

@media (max-width: 720px) {
  .gnx-custom-chat {
    right: 10px;
    bottom: var(--gnx-chat-bottom);
    left: 10px;
    width: auto;
  }

  .gnx-custom-chat__panel {
    right: 0;
    bottom: 78px;
    width: 100%;
    max-height: min(620px, calc(100vh - 112px));
  }

  .gnx-custom-chat__contact-fields {
    grid-template-columns: 1fr;
  }
}
