.lchat {
  --lchat-primary: #1d3f8f;
  --lchat-bg: #ffffff;
  --lchat-text: #1b2230;
  --lchat-muted: #6b7385;
  --lchat-bot: #f1f4f9;
  position: fixed;
  bottom: 20px;
  z-index: 999990;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--lchat-text);
}
.lchat--right { right: 20px; }
.lchat--left { left: 20px; }
.lchat *, .lchat *::before, .lchat *::after { box-sizing: border-box; }

.lchat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.lchat-launcher {
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--lchat-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  transition: transform .15s ease;
}
.lchat-launcher:hover { transform: scale(1.06); }
.lchat-launcher:focus-visible, .lchat button:focus-visible, .lchat a:focus-visible, .lchat textarea:focus-visible {
  outline: 3px solid #ffb400; outline-offset: 2px;
}
.lchat.is-open .lchat-launcher { display: none; }

.lchat-panel {
  position: absolute; bottom: 0;
  width: 370px; max-width: calc(100vw - 24px);
  height: 560px; max-height: calc(100vh - 40px);
  background: var(--lchat-bg); border-radius: 16px; overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
}
.lchat-panel[hidden] { display: none; }
.lchat--right .lchat-panel { right: 0; }
.lchat--left .lchat-panel { left: 0; }

.lchat-header {
  background: var(--lchat-primary); color: #fff;
  padding: 14px 14px 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.lchat-header strong { display: block; font-size: 16px; }
.lchat-header span { font-size: 12.5px; opacity: .85; }
.lchat-close { background: transparent; border: 0; color: #fff; cursor: pointer; padding: 6px; border-radius: 8px; display: flex; }
.lchat-close:hover { background: rgba(255,255,255,.15); }

.lchat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }

.lchat-msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; word-wrap: break-word; }
.lchat-msg--bot { background: var(--lchat-bot); align-self: flex-start; border-bottom-left-radius: 4px; }
.lchat-msg--user { background: var(--lchat-primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

.lchat-wa {
  display: inline-flex; align-items: center; margin-top: 10px;
  background: #1fa855; color: #fff !important; text-decoration: none !important;
  font-weight: 600; padding: 9px 14px; border-radius: 10px;
}
.lchat-wa::before { content: "💬"; margin-right: 6px; }
.lchat-wa:hover { background: #178f47; }

.lchat-typing { display: flex; gap: 4px; padding: 13px 15px; }
.lchat-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--lchat-muted); animation: lchat-dot 1.2s infinite ease-in-out; }
.lchat-typing span:nth-child(2) { animation-delay: .15s; }
.lchat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes lchat-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.lchat-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.lchat-quick:empty { display: none; }
.lchat-quick button {
  border: 1.5px solid var(--lchat-primary); background: #fff; color: var(--lchat-primary);
  border-radius: 999px; padding: 6px 12px; font-size: 13.5px; cursor: pointer; font-family: inherit;
}
.lchat-quick button:hover { background: var(--lchat-primary); color: #fff; }

.lchat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid #e4e8ef; }
.lchat-form textarea {
  flex: 1; resize: none; border: 1px solid #d5dbe5; border-radius: 12px;
  padding: 10px 12px; font: inherit; color: inherit; max-height: 120px; background: #fff;
}
.lchat-send {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--lchat-primary); color: #fff; display: flex; align-items: center; justify-content: center;
}
.lchat-form.is-busy .lchat-send { opacity: .5; cursor: wait; }

.lchat-note { margin: 0; padding: 0 14px 10px; font-size: 11.5px; color: var(--lchat-muted); text-align: center; }
.lchat-note a { color: var(--lchat-primary); }

@media (max-width: 480px) {
  .lchat { bottom: 14px; }
  .lchat--right { right: 14px; }
  .lchat--left { left: 14px; }
  .lchat.is-open { inset: 0; }
  .lchat.is-open .lchat-panel { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; }
  .lchat-form textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .lchat-launcher, .lchat-typing span { transition: none; animation: none; }
}
