:root {
  --pli-chat-primary: #173f59;
  --pli-chat-bottom: 20px;
  --pli-chat-side: 20px;
}

.pli-chat-widget,
.pli-chat-widget * {
  box-sizing: border-box;
}

.pli-chat-widget {
  position: fixed;
  bottom: var(--pli-chat-bottom);
  z-index: 1040;
  color: #173044;
  font-family: "Work Sans", Arial, sans-serif;
  line-height: 1.4;
}

.pli-chat-widget[data-position="right"] { right: var(--pli-chat-safe-side, var(--pli-chat-side)); }
.pli-chat-widget[data-position="left"] { left: var(--pli-chat-side); }

.pli-chat-launcher-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.pli-chat-widget[data-position="left"] .pli-chat-launcher-row { flex-direction: row-reverse; }

.pli-chat-launcher-label {
  max-width: 190px;
  padding: 10px 15px;
  overflow: hidden;
  color: #173044;
  background: #fff;
  border: 1px solid rgba(23, 48, 68, .12);
  border-radius: 22px;
  box-shadow: 0 5px 18px rgba(20, 42, 58, .16);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pli-chat-launcher {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  padding: 0;
  color: #fff;
  background: var(--pli-chat-primary);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 7px 22px rgba(20, 42, 58, .3);
  font-size: 22px;
  transition: transform .18s ease, box-shadow .18s ease;
}

.pli-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 26px rgba(20, 42, 58, .36);
}

.pli-chat-launcher:focus-visible,
.pli-chat-panel button:focus-visible,
.pli-chat-panel input:focus-visible,
.pli-chat-panel select:focus-visible,
.pli-chat-panel textarea:focus-visible {
  outline: 3px solid rgba(36, 127, 189, .3);
  outline-offset: 2px;
}

.pli-chat-panel {
  position: absolute;
  bottom: 70px;
  width: min(370px, calc(100vw - 32px));
  max-height: min(610px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(23, 48, 68, .12);
  border-radius: 16px;
  box-shadow: 0 14px 42px rgba(20, 42, 58, .24);
}

.pli-chat-widget[data-position="right"] .pli-chat-panel { right: 0; }
.pli-chat-widget[data-position="left"] .pli-chat-panel { left: 0; }
.pli-chat-panel[hidden] { display: none; }

.pli-chat-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 16px;
  color: #fff;
  background: var(--pli-chat-primary);
}

.pli-chat-header-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  background: rgba(255, 255, 255, .16);
  border-radius: 50%;
}

.pli-chat-header-copy { min-width: 0; flex: 1; }
.pli-chat-title { margin: 0; font-size: 16px; font-weight: 700; }
.pli-chat-status { margin-top: 2px; font-size: 12px; opacity: .9; }

.pli-chat-close,
.pli-chat-back {
  width: 32px;
  height: 32px;
  padding: 0;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.pli-chat-close:hover,
.pli-chat-back:hover { background: rgba(255, 255, 255, .14); }

.pli-chat-body {
  min-height: 280px;
  overflow-y: auto;
  background: #f7f9fa;
}

.pli-chat-view { padding: 18px; }
.pli-chat-view[hidden] { display: none; }
.pli-chat-welcome { margin: 0 0 16px; font-size: 14px; color: #506574; }

.pli-chat-field { margin-bottom: 13px; }
.pli-chat-field label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; }

.pli-chat-field input,
.pli-chat-field select,
.pli-chat-composer textarea {
  width: 100%;
  padding: 10px 11px;
  color: #173044;
  background: #fff;
  border: 1px solid #cbd6dc;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
}

.pli-chat-field input:focus,
.pli-chat-field select:focus,
.pli-chat-composer textarea:focus { border-color: var(--pli-chat-primary); }

.pli-chat-availability {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 11px;
  color: #475d6c;
  background: #edf2f4;
  border-radius: 8px;
  font-size: 12px;
}

.pli-chat-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  margin-top: 4px;
  background: #8a9aa4;
  border-radius: 50%;
}

.pli-chat-dot.is-online { background: #25a968; }
.pli-chat-primary-btn {
  width: 100%;
  padding: 11px 15px;
  color: #fff;
  background: var(--pli-chat-primary);
  border: 0;
  border-radius: 8px;
  font-weight: 700;
}

.pli-chat-primary-btn:disabled { cursor: not-allowed; opacity: .55; }
.pli-chat-messages { min-height: 250px; max-height: 350px; padding: 16px; overflow-y: auto; }

.pli-chat-system-message {
  margin: 28px auto;
  padding: 12px;
  color: #506574;
  background: #edf2f4;
  border-radius: 10px;
  font-size: 13px;
  text-align: center;
}

.pli-chat-message {
  display: flex;
  margin-bottom: 10px;
}

.pli-chat-message.is-own { justify-content: flex-end; }
.pli-chat-message.is-support { justify-content: flex-start; }

.pli-chat-bubble {
  max-width: 82%;
  padding: 9px 11px 6px;
  color: #173044;
  background: #fff;
  border: 1px solid #dce4e8;
  border-radius: 12px 12px 12px 3px;
  box-shadow: 0 1px 3px rgba(20, 42, 58, .06);
  overflow-wrap: anywhere;
}

.pli-chat-message.is-own .pli-chat-bubble {
  color: #fff;
  background: var(--pli-chat-primary);
  border-color: var(--pli-chat-primary);
  border-radius: 12px 12px 3px 12px;
}

.pli-chat-message-body { white-space: pre-wrap; font-size: 13px; }
.pli-chat-message-time { display: block; margin-top: 4px; font-size: 10px; opacity: .7; text-align: right; }

.pli-chat-attachment {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 7px 8px;
  color: inherit;
  background: rgba(255, 255, 255, .15);
  border: 1px solid currentColor;
  border-radius: 7px;
  font: inherit;
  font-size: 12px;
  text-align: left;
}

.pli-chat-message.is-support .pli-chat-attachment { background: #f3f6f7; }
.pli-chat-attachment span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pli-chat-composer {
  padding: 12px;
  background: #fff;
  border-top: 1px solid #e1e7ea;
}

.pli-chat-composer-row { display: flex; align-items: flex-end; gap: 8px; }
.pli-chat-composer textarea { min-height: 42px; max-height: 90px; resize: vertical; }

.pli-chat-icon-btn,
.pli-chat-send-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
}

.pli-chat-icon-btn { color: #526977; background: #edf2f4; }
.pli-chat-send-btn { color: #fff; background: var(--pli-chat-primary); }
.pli-chat-icon-btn:disabled,
.pli-chat-send-btn:disabled,
.pli-chat-composer textarea:disabled { cursor: not-allowed; opacity: .55; }

.pli-chat-files { margin-top: 7px; color: #506574; font-size: 11px; }
.pli-chat-composer-status { min-height: 16px; margin-top: 5px; color: #71838e; font-size: 11px; }
.pli-chat-note { margin: 9px 0 0; color: #71838e; font-size: 11px; text-align: center; }
.pli-chat-error { color: #a52b35; }

@media (max-width: 767.98px) {
  .pli-chat-widget {
    right: 12px !important;
    bottom: 12px;
    left: 12px !important;
  }

  .pli-chat-launcher-row { justify-content: flex-end; }
  .pli-chat-panel { right: 0 !important; left: 0 !important; width: 100%; max-height: calc(100vh - 100px); }
}

@media (prefers-reduced-motion: reduce) {
  .pli-chat-launcher { transition: none; }
}

