/* Agapitos AI Sales Widget — Isolated styles */
#agapitos-ai-floating-root,
#agapitos-ai-inline-root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  box-sizing: border-box;
}

/* ── Floating toggle button ── */
.aai-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  z-index: 99998;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transition: transform 0.2s, box-shadow 0.2s;
}
.aai-toggle-btn:hover { transform: scale(1.07); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }

/* ── Floating container ── */
.aai-chat-container.aai-floating {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  z-index: 99997;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: #e8edf2;
}
.aai-chat-container.aai-floating.aai-open { display: flex; }

/* ── Inline container ── */
.aai-chat-container.aai-inline {
  width: 100%;
  height: 580px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #e8edf2;
  border: 1px solid #dde1e7;
}

/* ── Header ── */
.aai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  flex-shrink: 0;
  color: #fff;
}
.aai-header-left { display: flex; align-items: center; gap: 10px; }
.aai-header-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.aai-header-title { font-size: 16px; font-weight: 600; color: #fff; }
.aai-header-subtitle { font-size: 11px; color: rgba(255,255,255,0.78); }
.aai-header-close {
  background: rgba(255,255,255,0.18); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.aai-header-close:hover { background: rgba(255,255,255,0.3); }

/* ── Messages area ── */
.aai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.aai-messages::-webkit-scrollbar { width: 4px; }
.aai-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 2px; }

/* ── Message rows ── */
.aai-msg-row { display: flex; align-items: flex-end; gap: 7px; }
.aai-msg-row.aai-user { justify-content: flex-end; }
.aai-msg-row.aai-bot  { justify-content: flex-start; }

.aai-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0; margin-bottom: 2px;
}

.aai-bubble {
  max-width: 76%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
}
.aai-bubble.aai-bot-bubble {
  background: #ffffff;
  color: #1a2433;
  border-bottom-left-radius: 4px;
}
.aai-bubble.aai-user-bubble {
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* ── Options grid ── */
.aai-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 0 4px 39px;
}
.aai-option-btn {
  border-radius: 10px;
  border-width: 2px;
  border-style: solid;
  background: #ffffff;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: center;
  line-height: 1.3;
}
.aai-option-btn:hover { filter: brightness(0.95); }
.aai-option-btn .aai-opt-desc {
  display: block;
  font-size: 11px;
  font-weight: 400;
  margin-top: 2px;
  opacity: 0.75;
}
.aai-option-btn:disabled { opacity: 0.45; cursor: default; }

/* ── Product cards ── */
.aai-products-scroll {
  display: flex;
  gap: 10px;
  padding: 4px 0 4px 39px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  height: 240px;
  align-items: stretch;
  flex-shrink: 0;
}
.aai-products-scroll::-webkit-scrollbar { height: 3px; }
.aai-products-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 2px; }

.aai-product-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #dde1e7;
  width: 180px;
  min-height: 220px;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.aai-product-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.12); }
.aai-product-card:visited { color: inherit; }

.aai-product-img {
  width: 100%; height: 120px;
  object-fit: cover;
  background: #dde4ea;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}
.aai-product-img img { width: 100%; height: 100%; object-fit: cover; }

.aai-product-info { padding: 10px; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.aai-product-name { font-size: 12px; font-weight: 600; color: #1a2433; line-height: 1.3; }
.aai-product-price { font-size: 14px; font-weight: 700; }
.aai-product-sale-old { font-size: 11px; color: #888; text-decoration: line-through; }
.aai-product-badge {
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 5px;
  display: inline-block; width: fit-content;
}
.aai-badge-instock  { background: #e8f5e9; color: #2e7d32; }
.aai-badge-outstock { background: #fff3e0; color: #e65100; }
.aai-product-cta {
  margin-top: auto;
  padding: 6px;
  border-radius: 7px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  display: block;
}

/* ── Loading dots ── */
.aai-loading {
  display: flex; gap: 5px; align-items: center; padding: 4px 0;
}
.aai-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #b0b8c4;
  animation: aai-bounce 1.2s infinite;
}
.aai-dot:nth-child(2) { animation-delay: 0.2s; }
.aai-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes aai-bounce {
  0%,80%,100% { transform: scale(0.7); opacity: 0.5; }
  40%          { transform: scale(1);   opacity: 1;   }
}

/* ── Input area ── */
.aai-input-area {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #dde1e7;
  flex-shrink: 0;
}
.aai-text-input {
  flex: 1;
  background: #f0f4f8;
  border: 1px solid #dde1e7;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 14px;
  color: #1a2433;
  resize: none;
  outline: none;
  max-height: 90px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.aai-text-input::placeholder { color: #a0aec0; }
.aai-text-input:focus { border-color: #a0b4c8; }
.aai-send-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: none; cursor: pointer; color: #fff;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: filter 0.15s, transform 0.1s;
}
.aai-send-btn:hover { filter: brightness(1.1); }
.aai-send-btn:active { transform: scale(0.94); }
.aai-send-btn:disabled { opacity: 0.45; cursor: default; }

/* ── Mobile responsive ── */
@media (max-width: 440px) {
  .aai-chat-container.aai-floating {
    right: 0; bottom: 0;
    width: 100vw; max-width: 100vw;
    height: 100dvh