.ap-live-chat {
  --ap-chat-accent: var(--ap-red, #e0001a);
  --ap-chat-blue: var(--ap-blue, #2b2e8f);
  --ap-chat-ink: #0b1024;
  --ap-chat-border: rgba(207, 207, 207, .82);
  --ap-chat-bg: var(--ap-bg, #ececec);
  --ap-chat-field: var(--ap-field, #f7f7f7);
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 9999;
  font-family: 'Nunito Sans', Arial, sans-serif;
}
.ap-live-chat[hidden], .ap-live-chat .ap-chat-window[hidden], .ap-live-chat .ap-chat-form[hidden], .ap-live-chat .ap-chat-intro[hidden], .ap-live-chat .ap-chat-launcher[hidden] { display: none; }
.ap-chat-launcher {
  position: relative;
  width: 70px;
  height: 70px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--ap-chat-accent), var(--ap-chat-blue));
  color: #fff;
  box-shadow: 0 18px 36px rgba(43,46,143,.24), 0 10px 24px rgba(224,0,26,.2);
  cursor: pointer;
  display: grid;
  place-items: center;
  isolation: isolate;
  animation: ap-chat-float 3.2s ease-in-out infinite;
}
.ap-chat-launcher::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(224, 0, 26, .34);
  border-radius: 26px;
  animation: ap-chat-pulse 2.4s ease-out infinite;
  z-index: -1;
}
.ap-chat-launcher__icon {
  width: 31px;
  height: 27px;
  background: currentColor;
  clip-path: polygon(0 0,100% 0,100% 72%,63% 72%,50% 100%,43% 72%,0 72%);
}
.ap-chat-launcher__badge {
  position: absolute;
  right: 78px;
  top: 50%;
  transform: translateY(-50%);
  width: max-content;
  padding: 9px 13px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: var(--ap-chat-blue);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(0,0,0,.12);
}
.ap-chat-window {
  width: min(404px, calc(100vw - 32px));
  height: 590px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 24px;
  box-shadow: 0 26px 70px rgba(11,16,36,.22);
  backdrop-filter: blur(16px);
}
.ap-chat-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px;
  color: #fff;
  background:
    radial-gradient(circle at 18% 0%, rgba(255,255,255,.22), transparent 34%),
    linear-gradient(135deg, var(--ap-chat-blue) 0%, #1d2851 62%, var(--ap-chat-accent) 140%);
}
.ap-chat-brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.ap-chat-logo-wrap {
  width: 96px;
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 6px 9px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
}
.ap-chat-logo { max-width: 80px; max-height: 26px; object-fit: contain; }
.ap-chat-title { font-size: 18px; font-weight: 900; line-height: 1.05; letter-spacing: .01em; }
.ap-chat-status { margin-top: 4px; font-size: 12px; font-weight: 700; opacity: .92; }
.ap-chat-actions { display: flex; gap: 7px; align-items: flex-start; }
.ap-chat-actions button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.ap-chat-actions button:hover { background: rgba(255,255,255,.24); transform: translateY(-1px); }
.ap-chat-body {
  flex: 1;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.54), rgba(255,255,255,0)),
    var(--ap-chat-bg);
  overflow: auto;
}
.ap-chat-bubble {
  max-width: 86%;
  padding: 13px 15px;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 18px;
  margin: 0 0 12px;
  background: rgba(255,255,255,.96);
  color: var(--ap-chat-ink);
  font-size: 14px;
  line-height: 1.42;
  box-shadow: 0 12px 28px rgba(0,0,0,.1);
}
.ap-chat-bubble small { display: block; margin-top: 7px; color: var(--ap-muted, #535353); font-size: 11px; }
.ap-chat-bubble.visitor { margin-left: auto; color: #fff; background: linear-gradient(135deg, var(--ap-chat-blue), #1d2851); border-color: rgba(43,46,143,.42); }
.ap-chat-bubble.visitor small { color: rgba(255,255,255,.78); }
.ap-chat-bubble.manager { border-left: 4px solid var(--ap-chat-accent); }
.ap-chat-bubble.system { color: var(--ap-muted, #535353); background: rgba(247,247,247,.9); box-shadow: none; }
.ap-chat-form, .ap-chat-intro { display: flex; gap: 9px; padding: 14px; border-top: 1px solid var(--ap-chat-border); background: rgba(255,255,255,.96); }
.ap-chat-intro { flex-direction: column; }
.ap-chat-intro__title { margin: 0 0 2px; color: var(--ap-chat-blue); font-size: 13px; font-weight: 900; }
.ap-chat-intro input, .ap-chat-form input {
  min-width: 0;
  border: 1px solid var(--ap-chat-border);
  border-radius: 13px;
  padding: 13px 14px;
  background: #fff;
  color: var(--ap-chat-ink);
  font: inherit;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.ap-chat-intro input:focus, .ap-chat-form input:focus { border-color: var(--ap-chat-blue); box-shadow: 0 0 0 4px rgba(43,46,143,.1); }
.ap-chat-form input { flex: 1; }
.ap-chat-intro button, .ap-chat-form button {
  border: 0;
  border-radius: 13px;
  padding: 13px 16px;
  background: linear-gradient(135deg, var(--ap-chat-accent), #ff3850);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(224,0,26,.22);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.ap-chat-intro button:hover, .ap-chat-form button:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(224,0,26,.28); }
.ap-chat-error { color: var(--ap-chat-accent); font-size: 13px; min-height: 18px; }
.ap-chat-powered { padding: 0 16px 12px; color: var(--ap-muted, #535353); font-size: 11px; text-align: right; background: rgba(255,255,255,.96); }
@keyframes ap-chat-pulse { 0% { opacity: .85; transform: scale(.9); } 70%,100% { opacity: 0; transform: scale(1.2); } }
@keyframes ap-chat-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .ap-chat-launcher, .ap-chat-launcher::after { animation: none; } }
@media (max-width:640px) {
  .ap-live-chat { right: 16px; bottom: 16px; }
  .ap-chat-window { height: calc(100vh - 32px); }
  .ap-chat-launcher__badge { display: none; }
  .ap-chat-header { grid-template-columns: 1fr auto; }
}
.ap-chat-bubble.is-new { animation: ap-chat-new-message 1.8s ease-out 1; outline: 2px solid rgba(224,0,26,.2); }
@keyframes ap-chat-new-message { 0% { transform: translateY(8px); box-shadow: 0 0 0 0 rgba(224,0,26,.28); } 45% { box-shadow: 0 0 0 8px rgba(224,0,26,.08); } 100% { transform: none; box-shadow: 0 12px 28px rgba(0,0,0,.1); } }
.ap-chat-status::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #9ca3af; box-shadow: 0 0 0 4px rgba(156,163,175,.16); }
.ap-chat-status.is-online::before { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.18); }
.ap-chat-status.is-offline::before { background: #9ca3af; box-shadow: 0 0 0 4px rgba(156,163,175,.16); }
.ap-chat-agreement { display: flex; gap: 8px; align-items: flex-start; color: var(--ap-muted, #535353); font-size: 12px; line-height: 1.35; }
.ap-chat-agreement input { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; accent-color: var(--ap-chat-accent); }
.ap-chat-agreement a { color: var(--ap-chat-blue); font-weight: 800; text-decoration: underline; }
.ap-chat-form { flex-direction: column; }
.ap-chat-compose { display: flex; gap: 9px; }
.ap-chat-compose input { flex: 1; }
.ap-chat-end {
  align-self: flex-start;
  border: 1px solid rgba(43,46,143,.18);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(43,46,143,.06);
  color: var(--ap-chat-blue);
  font-size: 12px;
  font-weight: 900;
  box-shadow: none;
}
.ap-chat-end:hover { background: rgba(43,46,143,.1); box-shadow: none; transform: none; }
.ap-chat-end:disabled { opacity: .6; cursor: wait; }
