.lgpx-launcher-btn {
  position: fixed;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: #4a7396;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lgpx-launcher-btn.lgpx-pos-right { right: 20px; }
.lgpx-launcher-btn.lgpx-pos-left { left: 20px; }
.lgpx-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #d64545;
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  padding: 4px 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.lgpx-widget {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  width: 360px;
  max-width: calc(100vw - 40px);
  border: 1px solid #e2ded0;
  border-radius: 10px;
  box-shadow: 0px 8px 24px rgba(0, 0, 0, 0.3);
  background: #f5f2df;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  bottom: 92px;
  z-index: 999998;
  max-height: calc(100vh - 112px);
}
.lgpx-widget.lgpx-pos-right { right: 20px; }
.lgpx-widget.lgpx-pos-left { left: 20px; }
.lgpx-widget--expanded {
  width: 480px;
}
.lgpx-widget--expanded .lgpx-messages {
  /* No min-height here - a min-height taller than the available viewport (via the
     outer max-height cap) forced the flex column to overflow, hiding the input row
     below it. max-height alone still gives more room on tall viewports. */
  max-height: 560px;
}
.lgpx-header {
  background: #4a7396;
  color: #fff;
  padding: 12px 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lgpx-icon-btn {
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
}
.lgpx-empty-state {
  flex: 1;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: #4a7396;
  font-size: 13px; /* 30% down from the original 18px */
  font-weight: 600;
  line-height: 1.5;
}
.lgpx-messages {
  flex: 1;
  min-height: 220px;
  max-height: 360px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lgpx-msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.lgpx-msg.visitor {
  align-self: flex-end;
  background: #4a7396;
  color: #fff;
}
.lgpx-msg.agent {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e2ded0;
}
.lgpx-msg.system {
  align-self: center;
  background: transparent;
  color: #7a7460;
  font-style: italic;
  font-size: 12px;
  text-align: center;
}
.lgpx-idle-banner {
  align-self: center;
  background: #fff3cd;
  border: 1px solid #ffe08a;
  color: #665200;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  text-align: center;
}
.lgpx-idle-banner button {
  margin-left: 8px;
  border: none;
  background: #4a7396;
  color: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
}
.lgpx-emoji-panel {
  position: absolute;
  left: 10px;
  bottom: 44px; /* clears the toolbar row the emoji button now lives in */
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  padding: 8px;
  background: #fff;
  border: 1px solid #e2ded0;
  border-radius: 8px;
  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.2);
}
.lgpx-emoji {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.lgpx-emoji:hover {
  background: #f5f2df;
}
.lgpx-input-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  border-top: 1px solid #e2ded0;
  background: #fff;
  flex-shrink: 0;
}
.lgpx-input-row textarea {
  flex: 1;
  border: none;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  font-family: inherit;
  line-height: 1.4;
}
.lgpx-input-row button {
  border: none;
  background: #4a7396;
  color: #fff;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 600;
  align-self: stretch;
}
.lgpx-input-row button:disabled {
  opacity: 0.5;
  cursor: default;
}
.lgpx-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: #fbf9f0;
  border-top: 1px solid #e2ded0;
  flex-shrink: 0;
}
.lgpx-toolbar .lgpx-icon-btn {
  color: #4a7396;
  background: transparent;
  font-size: 17px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.12s ease;
}
.lgpx-toolbar .lgpx-icon-btn:hover:not(:disabled) {
  background: #e7edf2;
}
.lgpx-toolbar .lgpx-icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
