.asa-chat {
  --asa-text: #111827;
  --asa-muted: #64748b;
  --asa-soft: #f8fafc;
  --asa-border: rgba(17, 24, 39, 0.12);
  --asa-shadow: 0 24px 70px rgba(17, 24, 39, 0.24);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  color: var(--asa-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.asa-chat--left {
  right: auto;
  left: 24px;
}

.asa-chat * {
  box-sizing: border-box;
}

.asa-chat__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.asa-chat button {
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
}

.asa-chat .asa-chat__launcher {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  min-height: 64px;
  border: 3px solid #fff !important;
  border-radius: 50%;
  padding: 0 !important;
  background: var(--asa-accent, #f97316) !important;
  color: #fff !important;
  line-height: 1;
  box-shadow: 0 16px 42px rgba(17, 24, 39, 0.28) !important;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.asa-chat .asa-chat__launcher:hover {
  background: var(--asa-accent, #f97316) !important;
  color: #fff !important;
  box-shadow: 0 20px 52px rgba(17, 24, 39, 0.34) !important;
  transform: translateY(-2px);
}

.asa-chat--open .asa-chat__launcher {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.94);
}

.asa-chat__nudge {
  position: absolute;
  right: calc(100% + 12px);
  bottom: 5px;
  display: flex;
  width: 280px;
  max-width: calc(100vw - 104px);
  align-items: flex-start;
  justify-content: flex-end;
  z-index: 1;
}

.asa-chat--left .asa-chat__nudge {
  right: auto;
  left: calc(100% + 12px);
  justify-content: flex-start;
}

.asa-chat--open .asa-chat__nudge {
  display: none;
}

.asa-chat .asa-chat__nudge-text {
  -webkit-appearance: none !important;
  appearance: none !important;
  flex: 1 1 auto;
  border: 1px solid var(--asa-border) !important;
  border-radius: 8px;
  padding: 11px 38px 11px 13px !important;
  background: var(--asa-bot-bg, #fff) !important;
  color: var(--asa-text) !important;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  white-space: normal !important;
  overflow-wrap: anywhere;
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.18) !important;
  cursor: pointer;
}

.asa-chat .asa-chat__nudge-text:hover,
.asa-chat .asa-chat__nudge-text:focus {
  border-color: color-mix(in srgb, var(--asa-accent, #f97316) 48%, var(--asa-border)) !important;
  background: #fff !important;
  color: var(--asa-text) !important;
}

.asa-chat .asa-chat__nudge-close {
  -webkit-appearance: none !important;
  appearance: none !important;
  position: absolute;
  top: -10px;
  right: -8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  border: 3px solid #fff !important;
  border-radius: 50%;
  padding: 0 !important;
  background: var(--asa-accent, #f97316) !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.2) !important;
  cursor: pointer;
}

.asa-chat--left .asa-chat__nudge-close {
  right: auto;
  left: -8px;
}

.asa-chat .asa-chat__nudge-close:hover,
.asa-chat .asa-chat__nudge-close:focus {
  background: color-mix(in srgb, var(--asa-accent, #f97316) 88%, #111827) !important;
  color: #fff !important;
}

.asa-chat__nudge-close svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.8;
}

.asa-chat__launcher-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: transparent;
  color: #fff;
}

.asa-chat__launcher-mark svg,
.asa-chat__send--icon svg,
.asa-chat__nudge-close svg,
.asa-chat__close svg {
  display: block;
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.asa-chat__launcher-text,
.asa-chat__send-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.asa-chat--launcher-compact .asa-chat__launcher {
  width: 56px;
  height: 56px;
  min-height: 56px;
}

.asa-chat--launcher-compact .asa-chat__launcher-mark svg {
  width: 21px;
  height: 21px;
}

.asa-chat__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  width: min(420px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 120px));
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--asa-border);
  border-radius: 8px;
  background: var(--asa-panel-bg, #f8fafc);
  box-shadow: var(--asa-shadow);
}

.asa-chat--left .asa-chat__panel {
  right: auto;
  left: 0;
}

.asa-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 14px 16px;
  border-bottom: 4px solid var(--asa-accent, #f97316);
  background: var(--asa-primary, #111827);
  color: #fff;
}

.asa-chat__identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.asa-chat__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  background: var(--asa-accent, #f97316);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.asa-chat__avatar svg {
  display: block;
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.asa-chat__title-wrap {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.asa-chat__header strong {
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asa-chat__header span span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
}

.asa-chat__header i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
}

.asa-chat .asa-chat__close {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 0 !important;
  border-radius: 50%;
  padding: 0 !important;
  background: rgba(17, 24, 39, 0.18) !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22) !important;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.asa-chat .asa-chat__close:hover {
  background: #fff !important;
  color: var(--asa-primary, #111827) !important;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.18) !important;
  transform: rotate(90deg);
}

.asa-chat__close svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.6;
}

.asa-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--asa-panel-bg, #f8fafc);
}

.asa-chat__history-loading {
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  padding: 34px 0;
}

.asa-chat__loader {
  display: inline-block;
  width: 48px;
  height: 48px;
  box-sizing: border-box;
  border: 5px solid var(--asa-accent, #f97316);
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: asa-chat-loader-rotation 1s linear infinite;
}

@keyframes asa-chat-loader-rotation {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.asa-chat__message {
  margin-bottom: 14px;
}

.asa-chat__message--user {
  display: flex;
  justify-content: flex-end;
}

.asa-chat__bubble {
  max-width: 88%;
  padding: 11px 13px;
  border: 1px solid var(--asa-border);
  border-radius: 8px;
  background: var(--asa-bot-bg, #fff);
  color: var(--asa-text);
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.06);
  white-space: pre-wrap;
}

.asa-chat__message--user .asa-chat__bubble {
  border-color: transparent;
  background: var(--asa-primary, #111827);
  color: #fff;
}

.asa-chat__message--assistant .asa-chat__bubble {
  white-space: normal;
}

.asa-chat__message--assistant .asa-chat__bubble p {
  margin: 0 0 8px;
}

.asa-chat__message--assistant .asa-chat__bubble h3,
.asa-chat__message--assistant .asa-chat__bubble h4 {
  margin: 0 0 8px;
  color: var(--asa-text);
  font-weight: 900;
  line-height: 1.25;
}

.asa-chat__message--assistant .asa-chat__bubble h3 {
  font-size: 15px;
}

.asa-chat__message--assistant .asa-chat__bubble h4 {
  font-size: 14px;
}

.asa-chat__message--assistant .asa-chat__bubble p:last-child,
.asa-chat__message--assistant .asa-chat__bubble h3:last-child,
.asa-chat__message--assistant .asa-chat__bubble h4:last-child,
.asa-chat__message--assistant .asa-chat__bubble ul:last-child,
.asa-chat__message--assistant .asa-chat__bubble ol:last-child {
  margin-bottom: 0;
}

.asa-chat__message--assistant .asa-chat__bubble ul,
.asa-chat__message--assistant .asa-chat__bubble ol {
  margin: 8px 0;
  padding-left: 18px;
}

.asa-chat__message--assistant .asa-chat__bubble li {
  margin: 4px 0;
}

.asa-chat__message--assistant .asa-chat__bubble a {
  color: var(--asa-primary, #111827);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.asa-chat__message--assistant .asa-chat__bubble code {
  border-radius: 5px;
  padding: 1px 4px;
  background: rgba(17, 24, 39, 0.08);
  font-size: 0.92em;
}

.asa-chat__message--thinking {
  display: flex;
  justify-content: flex-start;
}

.asa-chat__thinking {
  display: inline-flex;
  max-width: 88%;
  padding: 11px 13px;
  border: 1px solid var(--asa-border);
  border-radius: 8px;
  background: var(--asa-bot-bg, #fff);
  color: var(--asa-muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.06);
}

.asa-chat__thinking-char {
  display: inline-block;
  white-space: pre;
  animation: asa-chat-thinking-flash 1.2s ease-in-out infinite;
  animation-delay: var(--asa-thinking-delay, 0s);
}

@keyframes asa-chat-thinking-flash {
  0%,
  50%,
  100% {
    opacity: 1;
  }

  25%,
  75% {
    opacity: 0.18;
  }
}

.asa-chat__form {
  position: relative;
  display: block;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--asa-border);
  background: color-mix(in srgb, var(--asa-bot-bg, #fff) 88%, var(--asa-panel-bg, #f8fafc));
}

.asa-chat__input {
  display: block;
  height: 54px;
  min-height: 54px;
  max-height: 156px;
  width: 100%;
  resize: none;
  border: 1px solid var(--asa-border);
  border-radius: 16px;
  margin: 0;
  padding: 15px 58px 15px 16px;
  background: #fff;
  color: var(--asa-text);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  outline: none;
  overflow-y: hidden;
  appearance: none;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
}

.asa-chat__input:focus {
  border-color: var(--asa-accent, #f97316);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--asa-accent, #f97316) 18%, transparent);
}

.asa-chat__input.is-scrollable {
  overflow-y: auto;
}

.asa-chat__send,
.asa-chat__add,
.asa-chat__view {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--asa-accent, #f97316);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.asa-chat .asa-chat__send {
  min-width: 72px;
}

.asa-chat .asa-chat__send--icon {
  -webkit-appearance: none !important;
  appearance: none !important;
  position: absolute;
  right: 22px;
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 8px));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  border: 0 !important;
  border-radius: 50%;
  padding: 0 !important;
  background: linear-gradient(135deg, var(--asa-accent, #f97316), var(--asa-primary, #111827)) !important;
  color: #fff !important;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--asa-accent, #f97316) 36%, transparent) !important;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease, filter 160ms ease;
}

.asa-chat .asa-chat__send--icon:hover {
  background: linear-gradient(135deg, var(--asa-accent, #f97316), var(--asa-primary, #111827)) !important;
  color: #fff !important;
  box-shadow: 0 13px 30px color-mix(in srgb, var(--asa-accent, #f97316) 46%, transparent) !important;
  filter: saturate(1.08);
  transform: translateY(-1px);
}

.asa-chat .asa-chat__send--icon:focus-visible,
.asa-chat .asa-chat__close:focus-visible,
.asa-chat .asa-chat__launcher:focus-visible,
.asa-chat .asa-chat__nudge-text:focus-visible,
.asa-chat .asa-chat__nudge-close:focus-visible,
.asa-chat .asa-chat__carousel-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--asa-accent, #f97316) 34%, #fff);
  outline-offset: 2px;
}

.asa-chat__send--icon.is-busy svg {
  opacity: 0.5;
}

.asa-chat__send:disabled,
.asa-chat__add:disabled {
  opacity: 0.56;
  cursor: wait;
}

.asa-chat__products {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.asa-chat__products--carousel {
  display: block;
}

.asa-chat__carousel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.asa-chat__carousel-header span {
  color: var(--asa-muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.asa-chat__carousel-controls {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
}

.asa-chat .asa-chat__carousel-btn {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 1px solid var(--asa-border) !important;
  border-radius: 50% !important;
  padding: 0 !important;
  background: var(--asa-bot-bg, #fff) !important;
  color: var(--asa-primary, #111827) !important;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.08) !important;
  cursor: pointer;
}

.asa-chat .asa-chat__carousel-btn:hover,
.asa-chat .asa-chat__carousel-btn:focus {
  border-color: var(--asa-primary, #111827) !important;
  background: color-mix(in srgb, var(--asa-accent, #f97316) 10%, #fff) !important;
  color: var(--asa-primary, #111827) !important;
}

.asa-chat .asa-chat__carousel-btn:disabled {
  opacity: 0.42;
  cursor: default;
  transform: none;
}

.asa-chat__carousel-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 1px 2px 8px;
  scroll-padding: 2px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.asa-chat__carousel-slide {
  flex: 0 0 min(318px, calc(100% - 30px));
  scroll-snap-align: start;
}

.asa-chat__carousel-slide .asa-chat__product {
  height: 100%;
}

.asa-chat__product {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--asa-border);
  border-radius: 8px;
  background: var(--asa-bot-bg, #fff);
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.08);
}

.asa-chat__product-image {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 116px;
  border-right: 1px solid var(--asa-border);
  padding: 9px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.asa-chat__product-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asa-chat__product-body {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
  padding: 10px;
}

.asa-chat__product-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--asa-text);
  font-weight: 800;
  font-size: 13px;
  line-height: 1.25;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.asa-chat__product-price {
  display: block;
  color: var(--asa-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.32;
}

.asa-chat__product-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  margin-top: 1px;
}

.asa-chat .asa-chat__add,
.asa-chat .asa-chat__view {
  -webkit-appearance: none !important;
  appearance: none !important;
  min-height: 34px !important;
  border-radius: 999px !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

.asa-chat .asa-chat__add {
  border: 0 !important;
  background: var(--asa-primary, #111827) !important;
  color: #fff !important;
}

.asa-chat .asa-chat__add:hover,
.asa-chat .asa-chat__add:focus {
  background: color-mix(in srgb, var(--asa-primary, #111827) 88%, #000) !important;
  color: #fff !important;
}

.asa-chat .asa-chat__view {
  border: 1px solid color-mix(in srgb, var(--asa-primary, #111827) 20%, var(--asa-border)) !important;
  background: #fff !important;
  color: var(--asa-primary, #111827) !important;
}

.asa-chat .asa-chat__view:hover,
.asa-chat .asa-chat__view:focus {
  border-color: var(--asa-primary, #111827) !important;
  background: color-mix(in srgb, var(--asa-accent, #f97316) 10%, #fff) !important;
  color: var(--asa-primary, #111827) !important;
}

.asa-chat__notice {
  margin: 10px 0 0;
  padding: 10px 11px;
  border: 1px solid rgba(6, 95, 70, 0.14);
  border-radius: 8px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 13px;
}

.asa-chat__notice a {
  color: #065f46;
  font-weight: 800;
}

.asa-chat__notice:focus {
  outline: 3px solid color-mix(in srgb, var(--asa-accent, #f97316) 24%, #fff);
  outline-offset: 2px;
}

.asa-chat__noscript {
  max-width: 260px;
  margin: 10px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--asa-bot-bg, #fff);
  color: var(--asa-text);
  font-size: 13px;
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.12);
}

.asa-chat__account-card,
.asa-chat__support-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--asa-border);
  border-radius: 8px;
  background: var(--asa-bot-bg, #fff);
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.08);
}

.asa-chat__account-card strong,
.asa-chat__support-form strong {
  color: var(--asa-text);
  font-size: 14px;
}

.asa-chat__account-card p,
.asa-chat__support-form p {
  margin: 0;
  color: var(--asa-muted);
  font-size: 13px;
  line-height: 1.4;
}

.asa-chat__support-form label {
  display: grid;
  gap: 4px;
  color: var(--asa-muted);
  font-size: 12px;
  font-weight: 800;
}

.asa-chat__support-form input,
.asa-chat__support-form textarea {
  width: 100%;
  border: 1px solid var(--asa-border);
  border-radius: 8px;
  padding: 9px;
  background: #fff;
  color: var(--asa-text);
  font: inherit;
  font-size: 13px;
}

.asa-chat__support-form textarea {
  resize: vertical;
}

.asa-chat__hp {
  position: absolute;
  left: -9999px;
}

@media (prefers-reduced-motion: reduce) {
  .asa-chat__loader,
  .asa-chat__thinking-char {
    animation: none;
  }
}

@media (min-width: 768px) {
  .asa-chat__nudge {
    display: none;
  }
}

@supports not (color: color-mix(in srgb, #fff 50%, #000)) {
  .asa-chat__form {
    background: var(--asa-bot-bg, #fff);
  }

  .asa-chat__input:focus {
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
  }

  .asa-chat__send--icon {
    box-shadow: 0 10px 22px rgba(249, 115, 22, 0.22);
  }

  .asa-chat__send--icon:hover {
    box-shadow: 0 13px 28px rgba(249, 115, 22, 0.3);
  }
}

@media (max-width: 520px) {
  .asa-chat,
  .asa-chat--left {
    right: 14px;
    bottom: 14px;
    left: auto;
  }

  .asa-chat__panel,
  .asa-chat--left .asa-chat__panel {
    position: fixed;
    inset: 12px;
    width: auto;
    height: auto;
  }

  .asa-chat__launcher {
    width: 58px;
    height: 58px;
    min-height: 58px;
  }

  .asa-chat__carousel-slide {
    flex-basis: calc(100% - 22px);
  }

  .asa-chat__product {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .asa-chat__product-image {
    min-height: 108px;
    padding: 8px;
  }

  .asa-chat__product-body {
    gap: 6px;
    padding: 9px;
  }

  .asa-chat .asa-chat__add,
  .asa-chat .asa-chat__view {
    min-height: 32px !important;
    padding: 7px 10px !important;
  }
}
