.lt-chat-widget {
  --lt-black: #101010;
  --lt-white: #ffffff;
  --lt-paper: #f7f7f7;
  --lt-line: #e5e5e5;
  --lt-muted: #6f6f6f;
  --lt-red: #d71920;
  --lt-red-dark: #a80f14;
  --lt-bubble: #fff3f3;
  --lt-shadow: 0 24px 80px rgb(0 0 0 / 22%);
  position: fixed;
  right: clamp(14px, 3vw, 34px);
  bottom: clamp(14px, 3vw, 28px);
  z-index: 999;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--lt-black);
  pointer-events: none;
}

.lt-chat-widget *,
.lt-chat-widget *::before,
.lt-chat-widget *::after {
  box-sizing: border-box;
}

.lt-chat-widget button,
.lt-chat-widget input {
  font: inherit;
}

.lt-chat-widget button {
  cursor: pointer;
}

.lt-chat-panel {
  position: absolute;
  right: 0;
  bottom: 92px;
  display: grid;
  grid-template-rows: auto minmax(270px, 48vh) auto auto;
  width: min(420px, calc(100vw - 28px));
  height: min(660px, calc(100vh - 118px));
  overflow: hidden;
  background: var(--lt-white);
  border: 1px solid var(--lt-line);
  border-radius: 24px;
  box-shadow: var(--lt-shadow);
  pointer-events: auto;
  transform: translateY(18px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.lt-chat-widget.is-open .lt-chat-panel {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.lt-chat-header {
  display: grid;
  grid-template-columns: 58px 1fr 48px;
  gap: 14px;
  align-items: center;
  min-height: 110px;
  padding: 24px;
  color: var(--lt-white);
  background: var(--lt-black);
}

.lt-assistant-avatar {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: var(--lt-white);
  background: var(--lt-red);
  border-radius: 50%;
  font-weight: 900;
}

.lt-chat-header h2 {
  margin: 0;
  color: var(--lt-white);
  font-size: 22px;
  line-height: 1.1;
}

.lt-chat-header p {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 6px 0 0;
  color: rgb(255 255 255 / 70%);
}

.lt-chat-header p span {
  width: 9px;
  height: 9px;
  background: #4ade80;
  border-radius: 50%;
}

.lt-icon-button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: var(--lt-white);
  background: rgb(255 255 255 / 12%);
  border: 0;
  border-radius: 50%;
}

.lt-icon-button span {
  font-size: 24px;
  line-height: 1;
}

.lt-icon-button:hover {
  background: rgb(255 255 255 / 20%);
}

.lt-chat-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 24px 18px 18px;
  overflow-y: auto;
}

.lt-message {
  display: grid;
  max-width: 84%;
  padding: 14px 15px;
  border-radius: 16px;
  line-height: 1.48;
  white-space: pre-wrap;
}

.lt-message-bot {
  align-self: flex-start;
  color: var(--lt-black);
  background: var(--lt-bubble);
}

.lt-message-user {
  align-self: flex-end;
  color: var(--lt-white);
  background: var(--lt-black);
}

.lt-message-error {
  color: var(--lt-red-dark);
  background: #fff0f0;
  border: 1px solid rgb(215 25 32 / 24%);
}

.lt-message-success {
  color: #0b6f37;
  background: #ecfdf3;
  border: 1px solid rgb(11 111 55 / 22%);
}

.lt-message-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  width: fit-content;
  min-width: 56px;
  min-height: 42px;
}

.lt-message-typing span {
  width: 7px;
  height: 7px;
  background: var(--lt-red);
  border-radius: 50%;
  opacity: 0.35;
  animation: lt-typing-pulse 1s ease-in-out infinite;
}

.lt-message-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.lt-message-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes lt-typing-pulse {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.lt-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  min-height: 58px;
  max-height: 230px;
  padding: 10px 18px 16px;
  overflow-y: auto;
  background: var(--lt-white);
}

.lt-quick-actions:empty {
  min-height: 0;
  padding: 0 18px;
}

.lt-quick-actions button {
  min-height: 38px;
  padding: 9px 13px;
  color: var(--lt-black);
  background: var(--lt-white);
  border: 1px solid var(--lt-line);
  border-radius: 999px;
  font-weight: 800;
}

.lt-quick-actions button:hover {
  color: var(--lt-red);
  border-color: var(--lt-red);
}

.lt-quick-actions .lt-choice-action {
  display: grid;
  gap: 3px;
  flex: 1 1 100%;
  min-height: 58px;
  padding: 12px 14px;
  text-align: left;
  border-radius: 12px;
}

.lt-choice-action strong,
.lt-choice-action small {
  display: block;
}

.lt-choice-action strong {
  color: var(--lt-black);
  font-size: 14px;
}

.lt-choice-action small {
  color: var(--lt-muted);
  font-size: 12px;
}

.lt-choice-action.is-selected {
  border-color: var(--lt-red);
  background: #fff1f1;
}

.lt-choice-action.is-selected strong,
.lt-choice-action.is-selected small {
  color: var(--lt-red-dark);
}

.lt-quick-actions .lt-address-chip,
.lt-quick-actions .lt-action-primary,
.lt-quick-actions .lt-action-secondary {
  flex: 0 1 auto;
}

.lt-quick-actions .lt-action-primary {
  color: var(--lt-white);
  background: var(--lt-red);
  border-color: var(--lt-red);
}

.lt-quick-actions .lt-action-primary:hover {
  color: var(--lt-white);
  background: var(--lt-red-dark);
}

.lt-quick-actions .lt-action-secondary {
  color: var(--lt-muted);
}

.lt-chat-form {
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 10px;
  padding: 16px 18px;
  border-top: 1px solid var(--lt-line);
}

.lt-chat-form[hidden] {
  display: none;
}

.lt-chat-form input {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  color: var(--lt-black);
  background: var(--lt-paper);
  border: 1px solid var(--lt-line);
  border-radius: 999px;
  outline: none;
}

.lt-chat-form input:focus {
  border-color: var(--lt-red);
  box-shadow: 0 0 0 3px rgb(215 25 32 / 12%);
}

.lt-chat-form button {
  display: grid;
  width: 52px;
  min-height: 52px;
  place-items: center;
  color: var(--lt-white);
  background: var(--lt-black);
  border: 0;
  border-radius: 50%;
}

.lt-chat-form button:hover {
  background: var(--lt-red);
}

.lt-chat-form svg,
.lt-chat-launcher svg {
  width: 20px;
  height: 20px;
}

.lt-chat-launcher {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  margin-left: auto;
  color: var(--lt-white);
  background: var(--lt-black);
  border: 4px solid var(--lt-white);
  border-radius: 50%;
  box-shadow: 0 14px 45px rgb(0 0 0 / 28%);
  pointer-events: auto;
}

.lt-chat-launcher:hover {
  background: var(--lt-red);
}

@media (max-width: 680px) {
  .lt-chat-widget {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: auto;
    height: auto;
  }

  .lt-chat-panel {
    position: fixed;
    top: calc(var(--lt-visual-top, 0px) + 10px);
    right: 10px;
    bottom: auto;
    left: 10px;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    width: auto;
    height: calc(var(--lt-visual-vh, 100dvh) - 20px);
    max-height: 720px;
    border-radius: 22px;
  }

  .lt-chat-header {
    grid-template-columns: 50px 1fr 44px;
    min-height: 96px;
    padding: 18px;
  }

  .lt-assistant-avatar {
    width: 46px;
    height: 46px;
  }

  .lt-message {
    max-width: 92%;
  }

  .lt-quick-actions {
    min-height: 0;
    max-height: 168px;
    padding: 8px 18px 12px;
  }

  .lt-chat-form {
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 8px;
    padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  }

  .lt-chat-form input {
    min-width: 0;
    min-height: 48px;
  }

  .lt-chat-form button {
    width: 48px;
    min-height: 48px;
  }

  .lt-chat-widget.is-open .lt-chat-launcher {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}
