.lzai-widget {
  --lzai-bg: #090a0d;
  --lzai-panel: #11141a;
  --lzai-panel-soft: #171b22;
  --lzai-panel-elevated: #20252d;
  --lzai-line: rgba(218, 224, 232, .16);
  --lzai-line-strong: rgba(218, 224, 232, .28);
  --lzai-text: #f4f6f8;
  --lzai-muted: #9da6b2;
  --lzai-soft: #d7dce3;
  --lzai-red: var(--ld-accent-2, #9f2730);
  --lzai-red-bright: #c93440;
  --lzai-red-soft: rgba(159, 39, 48, .18);
  --lzai-silver: #d9dee5;
  --lzai-radius: var(--ld-radius-sm, 8px);
  --lzai-shadow: 0 22px 56px rgba(0, 0, 0, .46);
  color: var(--lzai-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  position: fixed;
  right: 20px;
  bottom: calc(var(--lzai-bottom-desktop, 24px) + env(safe-area-inset-bottom));
  z-index: 999999;
}

.lzai-widget * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.lzai-inline {
  position: relative;
  right: auto;
  bottom: auto;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  margin: 24px auto;
}

.lzai-inline .lzai-panel {
  display: flex;
  min-height: 560px;
}

/* ── Launcher: compact circular FAB, icon-only, hover tooltip ── */
.lzai-launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--lzai-line-strong);
  border-radius: 50%;
  background: linear-gradient(160deg, #20252d, #10131a);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.lzai-launcher::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  padding: 1px;
  background: linear-gradient(140deg, var(--lzai-red), transparent 55%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: .85;
}

.lzai-launcher:hover {
  transform: translateY(-2px);
  border-color: rgba(217, 222, 229, .45);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255, 255, 255, .07);
}

.lzai-launcher:focus-visible,
.lzai-close:focus-visible,
.lzai-form button:focus-visible,
.lzai-action:focus-visible,
.lzai-chip:focus-visible {
  outline: 3px solid rgba(201, 52, 64, .3);
  outline-offset: 3px;
}

.lzai-launcher-open,
.lzai-launcher-close {
  grid-area: 1 / 1;
  transition: opacity .16s ease, transform .16s ease;
}

.lzai-launcher-close {
  opacity: 0;
  transform: scale(.6) rotate(-45deg);
}

.lzai-launcher.is-open .lzai-launcher-open {
  opacity: 0;
  transform: scale(.6) rotate(45deg);
}

.lzai-launcher.is-open .lzai-launcher-close {
  opacity: 1;
  transform: none;
}

.lzai-launcher-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(4px);
  white-space: nowrap;
  padding: 7px 11px;
  border: 1px solid var(--lzai-line);
  border-radius: 7px;
  background: rgba(14, 17, 22, .96);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.lzai-launcher:hover .lzai-launcher-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.lzai-launcher.is-open .lzai-launcher-tooltip {
  display: none;
}

/* ── Panel ── */
.lzai-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(392px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 130px));
  min-height: 460px;
  overflow: hidden;
  border: 1px solid var(--lzai-line);
  border-radius: var(--lzai-radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .045), transparent 130px),
    linear-gradient(180deg, rgba(17, 20, 26, .98), rgba(8, 10, 13, .98));
  box-shadow: var(--lzai-shadow);
  backdrop-filter: blur(18px);
}

.lzai-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--lzai-red), rgba(217, 222, 229, .5), transparent);
  pointer-events: none;
}

.lzai-panel[hidden] {
  display: none !important;
}

.lzai-widget:not(.lzai-inline) .lzai-panel {
  position: absolute;
  right: 0;
  bottom: 66px;
  animation: lzaiPanelIn .2s ease both;
}

.lzai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(218, 224, 232, .1);
  background: rgba(255, 255, 255, .025);
}

.lzai-header-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.lzai-header-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--lzai-line);
  background: linear-gradient(160deg, #262b33, #14171d);
  color: #fff;
}

.lzai-header strong {
  display: block;
  color: #fff;
  font-size: 14.5px;
  font-weight: 900;
  line-height: 1.25;
}

.lzai-header span {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
  color: var(--lzai-muted);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .02em;
}

.lzai-header span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: #35c07a;
  box-shadow: 0 0 0 3px rgba(53, 192, 122, .16);
}

.lzai-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(217, 222, 229, .16);
  border-radius: 7px;
  background: rgba(255, 255, 255, .045);
  color: #fff;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}

.lzai-close:hover {
  border-color: rgba(217, 222, 229, .28);
  background: rgba(255, 255, 255, .075);
}

.lzai-messages {
  flex: 1;
  overflow: auto;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 222, 229, .28) transparent;
}

.lzai-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 0 0 10px;
  animation: lzaiMsgIn .2s ease both;
}

.lzai-msg.user {
  justify-content: flex-end;
}

.lzai-msg-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--lzai-line);
  background: linear-gradient(160deg, #262b33, #14171d);
  color: var(--lzai-muted);
}

.lzai-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border: 1px solid rgba(217, 222, 229, .13);
  border-radius: var(--lzai-radius);
  background: rgba(255, 255, 255, .055);
  color: var(--lzai-soft);
  font-size: 13.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.lzai-bubble strong {
  color: #fff;
}

.lzai-msg.bot .lzai-bubble {
  background:
    linear-gradient(90deg, rgba(217, 222, 229, .07), transparent 70px),
    rgba(255, 255, 255, .048);
}

.lzai-msg.user .lzai-bubble {
  border-color: rgba(201, 52, 64, .38);
  background:
    linear-gradient(180deg, rgba(201, 52, 64, .2), rgba(159, 39, 48, .16)),
    #15191f;
  color: #fff;
}

.lzai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.lzai-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid rgba(217, 222, 229, .17);
  border-radius: 7px;
  background: rgba(255, 255, 255, .055);
  color: #fff !important;
  padding: 7px 9px;
  text-decoration: none !important;
  font-size: 11.5px;
  font-weight: 850;
  line-height: 1.15;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.lzai-action:hover {
  transform: translateY(-1px);
  border-color: rgba(217, 222, 229, .32);
  background: rgba(255, 255, 255, .085);
}

.lzai-action[data-type="primary"] {
  border-color: rgba(201, 52, 64, .42);
  background: linear-gradient(180deg, #b72d38, #8e2028);
}

.lzai-action[data-type="whatsapp"] {
  border-color: rgba(50, 190, 116, .34);
  background: rgba(50, 190, 116, .14);
}

.lzai-action[data-type="download"] {
  border-color: rgba(217, 222, 229, .28);
  background: rgba(217, 222, 229, .1);
}

.lzai-quick {
  display: flex;
  gap: 6px;
  overflow: auto;
  padding: 0 14px 12px;
  scrollbar-width: none;
}

.lzai-quick::-webkit-scrollbar {
  display: none;
}

.lzai-chip {
  flex: 0 0 auto;
  min-height: 30px;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid rgba(217, 222, 229, .16);
  border-radius: 7px;
  background: rgba(255, 255, 255, .045);
  color: #f7f8fa;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 820;
  line-height: 1.1;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.lzai-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(217, 222, 229, .3);
  background: rgba(255, 255, 255, .075);
}

.lzai-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(218, 224, 232, .1);
  background: rgba(255, 255, 255, .025);
}

.lzai-form input {
  width: 100%;
  height: 40px;
  min-width: 0;
  border: 1px solid rgba(217, 222, 229, .15);
  border-radius: var(--lzai-radius);
  background: #090c11;
  color: #fff;
  outline: none;
  padding: 0 12px;
  font: inherit;
  font-size: 13.5px;
}

.lzai-form input::placeholder {
  color: rgba(217, 222, 229, .52);
}

.lzai-form input:focus {
  border-color: rgba(201, 52, 64, .5);
  box-shadow: 0 0 0 3px rgba(201, 52, 64, .12);
}

.lzai-form button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(201, 52, 64, .38);
  border-radius: var(--lzai-radius);
  background: linear-gradient(180deg, #c93440, #8e2028);
  color: #fff;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease;
}

.lzai-form button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.lzai-form button[disabled] {
  cursor: not-allowed;
  opacity: .58;
  transform: none;
}

.lzai-privacy {
  margin: 0;
  padding: 0 14px 12px;
  color: #89929f;
  font-size: 10.5px;
  line-height: 1.4;
}

.lzai-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 36px;
}

.lzai-typing span {
  width: 5px;
  height: 5px;
  border-radius: 99px;
  background: var(--lzai-silver);
  animation: lzaiDot 1s infinite ease-in-out;
}

.lzai-typing span:nth-child(2) {
  animation-delay: .14s;
}

.lzai-typing span:nth-child(3) {
  animation-delay: .28s;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes lzaiPanelIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes lzaiMsgIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes lzaiDot {
  0%,
  80%,
  100% {
    opacity: .35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 760px) {
  .lzai-widget {
    right: 12px;
    bottom: calc(var(--lzai-bottom-mobile, 86px) + env(safe-area-inset-bottom));
  }

  .lzai-launcher {
    width: 50px;
    height: 50px;
  }

  .lzai-launcher-tooltip {
    display: none;
  }

  .lzai-widget:not(.lzai-inline) .lzai-panel {
    position: fixed;
    right: 10px;
    left: 10px;
    bottom: calc(var(--lzai-bottom-mobile, 86px) + 60px + env(safe-area-inset-bottom));
    width: auto;
    height: min(600px, calc(100vh - 160px));
    min-height: 420px;
  }

  .lzai-inline .lzai-panel {
    height: 580px;
    min-height: 460px;
  }

  .lzai-bubble {
    max-width: 88%;
  }

  .lzai-chip {
    max-width: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lzai-widget * {
    animation: none !important;
    transition: none !important;
  }
}
