/*
 * Herb Terra Chatbot Widget v3.0 — Gorgias-style airy layout
 * Mobile-first · gradient brand header · bubble-less bot side · card schema
 */

#ht-chatbot-widget {
  --ht-primary: #108474;
  --ht-primary-deep: #0a5e52;
  --ht-primary-soft: #5fa893;
  --ht-primary-tint: #e6f5f2;
  --ht-gradient: linear-gradient(135deg, #5fa893 0%, #108474 55%, #0a5e52 100%);
  --ht-bg: #ffffff;
  --ht-bg-soft: #f8faf9;
  --ht-bg-user: #f0f3f2;
  --ht-text: #0e1a17;
  --ht-text-soft: #5b6b67;
  --ht-text-mute: #8a9a96;
  --ht-text-on-primary: #ffffff;
  --ht-border: #e6ebe9;
  --ht-border-soft: #f0f3f2;
  --ht-shadow-panel: 0 24px 48px -12px rgba(10, 94, 82, 0.18), 0 8px 16px -8px rgba(10, 94, 82, 0.12);
  --ht-shadow-launcher: 0 8px 24px rgba(16, 132, 116, 0.32);
  --ht-shadow-card: 0 1px 2px rgba(10, 94, 82, 0.08), 0 4px 12px -4px rgba(10, 94, 82, 0.08);
  --ht-radius: 20px;
  --ht-radius-card: 14px;
  --ht-radius-pill: 999px;
  --ht-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --ht-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ht-success: #1f9d55;
  --ht-warn: #d97706;
  --ht-danger: #dc2626;

  font-size: 15px;
  line-height: 1.55;
}

@media (prefers-color-scheme: dark) {
  #ht-chatbot-widget {
    --ht-bg: #14181b;
    --ht-bg-soft: #1a1f22;
    --ht-bg-user: #1e2528;
    --ht-text: #f1f5f4;
    --ht-text-soft: #b4c1bd;
    --ht-text-mute: #7c8a86;
    --ht-border: #2a3236;
    --ht-border-soft: #1f2528;
    --ht-primary-tint: #0c2a25;
    --ht-shadow-panel: 0 24px 48px -12px rgba(0, 0, 0, 0.6), 0 8px 16px -8px rgba(0, 0, 0, 0.4);
  }
}

#ht-chatbot-widget,
#ht-chatbot-widget *,
#ht-chatbot-widget *::before,
#ht-chatbot-widget *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--ht-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#ht-chatbot-widget button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

#ht-chatbot-widget a { color: var(--ht-primary); text-decoration: none; }
#ht-chatbot-widget a:hover { text-decoration: underline; }

/* ─────────────── Launcher ─────────────── */
#ht-launcher {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 99998;
  background: var(--ht-gradient);
  color: var(--ht-text-on-primary);
  box-shadow: var(--ht-shadow-launcher);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s var(--ht-ease), box-shadow 0.18s var(--ht-ease), border-radius 0.25s var(--ht-ease);
}
#ht-launcher:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 12px 28px rgba(16, 132, 116, 0.42); }
#ht-launcher:active { transform: scale(0.96); }

#ht-launcher.ht-launcher-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}
#ht-launcher.ht-launcher-icon svg { width: 28px; height: 28px; }

#ht-launcher.ht-launcher-pill {
  height: 52px;
  padding: 0 22px 0 18px;
  border-radius: var(--ht-radius-pill);
  gap: 10px;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.01em;
}
#ht-launcher.ht-launcher-pill svg { width: 20px; height: 20px; }
#ht-launcher.ht-launcher-pill .ht-launcher-label { white-space: nowrap; }

#ht-launcher .ht-icon-open { display: flex; align-items: center; justify-content: center; transition: opacity 0.2s var(--ht-ease), transform 0.2s var(--ht-ease); }
#ht-launcher .ht-icon-close { display: none; align-items: center; justify-content: center; }
#ht-launcher.ht-active .ht-icon-open { display: none; }
#ht-launcher.ht-active .ht-icon-close { display: flex; }
#ht-launcher.ht-active .ht-launcher-label { display: none; }
#ht-launcher.ht-active.ht-launcher-pill { width: 56px; padding: 0; border-radius: 50%; }

#ht-unread {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--ht-radius-pill);
  background: var(--ht-danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ht-bg);
  z-index: 1;
}
#ht-unread.ht-show { display: flex; animation: ht-pop 0.3s var(--ht-ease); }

@keyframes ht-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ─────────────── Welcome nudge ─────────────── */
#ht-nudge {
  position: fixed;
  bottom: 96px;
  right: 22px;
  z-index: 99997;
  max-width: 280px;
  padding: 14px 38px 14px 16px;
  background: var(--ht-bg);
  color: var(--ht-text);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(10, 94, 82, 0.18);
  font-size: 13.5px;
  line-height: 1.5;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.3s var(--ht-ease), transform 0.3s var(--ht-ease);
}
#ht-nudge.ht-show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#ht-nudge::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 26px;
  width: 14px;
  height: 14px;
  background: var(--ht-bg);
  transform: rotate(45deg);
  box-shadow: 3px 3px 6px rgba(10, 94, 82, 0.06);
}
#ht-nudge strong { color: var(--ht-primary); display: block; margin-bottom: 3px; font-size: 14px; }
#ht-nudge-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ht-text-mute);
}
#ht-nudge-close svg { width: 12px; height: 12px; }
#ht-nudge-close:hover { background: var(--ht-bg-soft); color: var(--ht-text); }

/* ─────────────── Panel ─────────────── */
#ht-panel {
  position: fixed;
  bottom: 96px;
  right: 22px;
  z-index: 99999;
  width: 420px;
  height: min(680px, calc(100vh - 120px));
  background: var(--ht-bg);
  border-radius: var(--ht-radius);
  box-shadow: var(--ht-shadow-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.22s var(--ht-ease), transform 0.22s var(--ht-ease);
}
#ht-panel.ht-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* ─────────────── Header ─────────────── */
#ht-header {
  position: relative;
  flex-shrink: 0;
  background: var(--ht-gradient);
  color: var(--ht-text-on-primary);
  padding: 18px 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
#ht-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 60%);
  pointer-events: none;
}

#ht-brand { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; position: relative; z-index: 1; }
#ht-brand-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}
#ht-brand-avatar img { width: 100%; height: 100%; object-fit: cover; }
#ht-brand-text { min-width: 0; flex: 1; }
#ht-brand-name { font-size: 16px; font-weight: 700; line-height: 1.2; }
#ht-brand-status {
  font-size: 12.5px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
#ht-brand-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.3);
  flex-shrink: 0;
}
#ht-brand-status.ht-offline::before { background: #fbbf24; box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3); }

#ht-header-actions { display: flex; gap: 6px; flex-shrink: 0; position: relative; z-index: 1; }
.ht-header-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  transition: background 0.15s var(--ht-ease);
}
.ht-header-btn:hover { background: rgba(255, 255, 255, 0.22); }
.ht-header-btn svg { width: 16px; height: 16px; }
.ht-header-btn.ht-wa { background: #25D366; }
.ht-header-btn.ht-wa:hover { background: #1da851; }

/* ─────────────── Body (welcome / conversation) ─────────────── */
#ht-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--ht-bg);
}

.ht-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ht-view.ht-hidden { display: none; }

/* ─────────────── Welcome view ─────────────── */
#ht-welcome {
  padding: 28px 22px 18px;
  overflow-y: auto;
  gap: 0;
}
.ht-welcome-hero {
  text-align: left;
  margin-bottom: 22px;
}
.ht-welcome-greeting {
  font-size: 24px;
  font-weight: 700;
  color: var(--ht-text);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.ht-welcome-sub {
  font-size: 14.5px;
  color: var(--ht-text-soft);
  line-height: 1.55;
}
.ht-welcome-trust {
  font-size: 11px;
  color: var(--ht-text-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 14px;
  font-weight: 600;
}
.ht-welcome-section-label {
  font-size: 11.5px;
  color: var(--ht-text-mute);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 14px 0 10px;
}
.ht-welcome-chips { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.ht-welcome-chip {
  padding: 13px 16px;
  background: var(--ht-bg-soft);
  border: 1px solid var(--ht-border);
  border-radius: 12px;
  font-size: 14px;
  color: var(--ht-text);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.15s var(--ht-ease), border-color 0.15s var(--ht-ease), transform 0.1s var(--ht-ease);
  font-weight: 500;
}
.ht-welcome-chip:hover {
  background: var(--ht-primary-tint);
  border-color: var(--ht-primary);
}
.ht-welcome-chip:active { transform: scale(0.99); }
.ht-welcome-chip svg { width: 14px; height: 14px; color: var(--ht-text-mute); flex-shrink: 0; }
.ht-welcome-chip:hover svg { color: var(--ht-primary); }

.ht-welcome-shortcuts { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.ht-welcome-shortcut {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  background: var(--ht-bg);
  border: 1px solid var(--ht-border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ht-text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.ht-welcome-shortcut:hover { background: var(--ht-primary-tint); border-color: var(--ht-primary); color: var(--ht-primary); }
.ht-welcome-shortcut svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ─────────────── Conversation view ─────────────── */
#ht-conversation { background: var(--ht-bg); }
#ht-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--ht-border) transparent;
}
#ht-messages::-webkit-scrollbar { width: 4px; }
#ht-messages::-webkit-scrollbar-thumb { background: var(--ht-border); border-radius: 4px; }
#ht-messages::-webkit-scrollbar-thumb:hover { background: var(--ht-text-mute); }

#ht-scroll-bottom {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--ht-bg);
  color: var(--ht-text);
  border: 1px solid var(--ht-border);
  border-radius: var(--ht-radius-pill);
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 14px rgba(10, 94, 82, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ht-ease), transform 0.18s var(--ht-ease);
  z-index: 2;
}
#ht-scroll-bottom svg { width: 13px; height: 13px; }
#ht-scroll-bottom.ht-show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }

/* ─────────────── Messages — airy bubble-less ─────────────── */
.ht-msg { display: flex; min-width: 0; max-width: 100%; animation: ht-msg-in 0.28s var(--ht-ease); }
@keyframes ht-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* User side — soft pill on right */
.ht-msg-user { align-self: flex-end; max-width: 84%; }
.ht-msg-user .ht-msg-bubble {
  background: var(--ht-bg-user);
  color: var(--ht-text);
  padding: 11px 16px;
  border-radius: 18px 18px 4px 18px;
  font-size: 14.5px;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.ht-msg-user .ht-msg-time { text-align: right; padding-right: 6px; }

/* Bot side — no bubble, just avatar + flowing text */
.ht-msg-bot {
  align-self: flex-start;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ht-msg-bot-row { display: flex; gap: 10px; align-items: flex-start; }
.ht-msg-bot-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ht-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
  overflow: hidden;
}
.ht-msg-bot-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ht-msg-bot-content {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ht-text);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  padding-top: 1px;
}
.ht-msg-bot-content > p + p { margin-top: 0.55em; }
.ht-msg-bot-content strong { font-weight: 600; color: var(--ht-text); }
.ht-msg-bot-content em { font-style: italic; color: var(--ht-text-soft); }
.ht-msg-bot-content code { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 13px; background: var(--ht-bg-soft); padding: 1px 5px; border-radius: 4px; }
.ht-msg-bot-content ul { margin: 0.4em 0 0.4em 1.2em; }
.ht-msg-bot-content li { margin: 0.2em 0; }

.ht-msg-time {
  font-size: 11px;
  color: var(--ht-text-mute);
  margin-top: 2px;
  padding-left: 40px;
}

/* Bot extras (cards, citations, ratings) sit under the content, aligned with content (not avatar) */
.ht-msg-extras { padding-left: 40px; display: flex; flex-direction: column; gap: 10px; }

/* ─────────────── Citation strip ─────────────── */
.ht-citation {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--ht-text-mute);
  padding: 4px 0;
}
.ht-citation-label { font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; opacity: 0.85; }
.ht-citation-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--ht-radius-pill);
  background: var(--ht-bg-soft);
  border: 1px solid var(--ht-border-soft);
  color: var(--ht-text-soft);
  font-size: 10.5px;
}
.ht-citation-pill svg { width: 9px; height: 9px; }

/* ─────────────── Rating + Retry ─────────────── */
.ht-rating { display: flex; gap: 6px; align-items: center; padding: 2px 0; }
.ht-rating-label { font-size: 11.5px; color: var(--ht-text-mute); }
.ht-rate-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--ht-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ht-text-mute);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.ht-rate-btn svg { width: 13px; height: 13px; }
.ht-rate-btn:hover { border-color: var(--ht-primary); color: var(--ht-primary); background: var(--ht-primary-tint); }
.ht-rated { font-size: 11.5px; color: var(--ht-text-mute); }

.ht-retry-btn {
  align-self: flex-start;
  border: 1px solid var(--ht-danger);
  color: var(--ht-danger);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ht-retry-btn svg { width: 13px; height: 13px; }
.ht-retry-btn:hover { background: rgba(220, 38, 38, 0.06); }

/* ─────────────── Typing indicator ─────────────── */
.ht-typing { display: flex; gap: 5px; align-items: center; padding: 8px 0 4px; }
.ht-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ht-text-mute);
  animation: ht-typing 1.4s ease-in-out infinite;
}
.ht-typing-dot:nth-child(2) { animation-delay: 0.18s; }
.ht-typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes ht-typing {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.ht-tool-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ht-text-soft);
  padding: 4px 0;
}
.ht-tool-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ht-primary);
  animation: ht-pulse 1.2s ease-in-out infinite;
}
@keyframes ht-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* ─────────────── Product cards & carousel ─────────────── */
.ht-cards {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 2px 4px 6px 0;
  scrollbar-width: thin;
}
.ht-cards::-webkit-scrollbar { height: 4px; }
.ht-cards::-webkit-scrollbar-thumb { background: var(--ht-border); border-radius: 4px; }

.ht-product-card {
  flex-shrink: 0;
  scroll-snap-align: start;
  width: 168px;
  background: var(--ht-bg);
  border: 1px solid var(--ht-border);
  border-radius: var(--ht-radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s var(--ht-ease), box-shadow 0.18s var(--ht-ease), border-color 0.18s var(--ht-ease);
}
.ht-product-card:hover { transform: translateY(-2px); border-color: var(--ht-primary); box-shadow: var(--ht-shadow-card); }
.ht-product-card.ht-oos { opacity: 0.65; }

.ht-product-img-wrap {
  position: relative;
  width: 100%;
  height: 130px;
  background: var(--ht-bg-soft);
  overflow: hidden;
}
.ht-product-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ht-product-img-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--ht-primary-soft); }
.ht-product-img-placeholder svg { width: 38px; height: 38px; }

.ht-product-body { padding: 10px 12px 4px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ht-product-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ht-text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ht-product-price { font-size: 13.5px; font-weight: 700; color: var(--ht-primary); }
.ht-product-price-strike { font-size: 11.5px; color: var(--ht-text-mute); text-decoration: line-through; margin-left: 4px; font-weight: 400; }

.ht-product-actions { padding: 0 10px 10px; }
.ht-product-btn {
  width: 100%;
  padding: 9px 8px;
  background: var(--ht-primary);
  color: white;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s var(--ht-ease);
}
.ht-product-btn:hover { background: var(--ht-primary-deep); }
.ht-product-btn:disabled { cursor: default; }
.ht-product-btn svg { width: 13px; height: 13px; }
.ht-product-btn.ht-btn-oos { background: var(--ht-text-mute); pointer-events: none; }
.ht-product-btn.ht-btn-added {
  background: var(--ht-success);
  animation: ht-pulse-check 0.5s var(--ht-ease);
}
@keyframes ht-pulse-check {
  0% { transform: scale(1); }
  40% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Skeleton loaders */
.ht-skeleton-card {
  flex-shrink: 0;
  scroll-snap-align: start;
  width: 168px;
  background: var(--ht-bg);
  border: 1px solid var(--ht-border);
  border-radius: var(--ht-radius-card);
  overflow: hidden;
}
.ht-skel-img, .ht-skel-line {
  background: linear-gradient(90deg, var(--ht-bg-soft) 0%, var(--ht-border-soft) 50%, var(--ht-bg-soft) 100%);
  background-size: 200% 100%;
  animation: ht-skel-shimmer 1.4s ease-in-out infinite;
}
.ht-skel-img { height: 130px; }
.ht-skel-line { height: 12px; border-radius: 4px; margin: 8px 12px; }
.ht-skel-line.ht-skel-short { width: 50%; }
@keyframes ht-skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─────────────── Order card ─────────────── */
.ht-order-card {
  background: var(--ht-bg);
  border: 1px solid var(--ht-border);
  border-radius: var(--ht-radius-card);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ht-order-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ht-order-num { font-size: 14px; font-weight: 700; color: var(--ht-text); }
.ht-order-status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--ht-radius-pill);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.ht-order-status-pill.ht-status-paid,
.ht-order-status-pill.ht-status-fulfilled { background: rgba(31, 157, 85, 0.12); color: var(--ht-success); }
.ht-order-status-pill.ht-status-pending,
.ht-order-status-pill.ht-status-unfulfilled { background: rgba(217, 119, 6, 0.12); color: var(--ht-warn); }
.ht-order-status-pill.ht-status-cancelled,
.ht-order-status-pill.ht-status-refunded { background: rgba(220, 38, 38, 0.1); color: var(--ht-danger); }
.ht-order-meta { font-size: 12.5px; color: var(--ht-text-soft); display: flex; gap: 10px; flex-wrap: wrap; }
.ht-order-items { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-top: 1px solid var(--ht-border-soft); border-bottom: 1px solid var(--ht-border-soft); }
.ht-order-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.ht-order-item-img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; background: var(--ht-bg-soft); flex-shrink: 0; }
.ht-order-item-title { flex: 1; min-width: 0; color: var(--ht-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-order-item-qty { color: var(--ht-text-mute); font-size: 12px; flex-shrink: 0; }
.ht-order-track {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--ht-primary-tint);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ht-primary-deep);
  font-weight: 600;
}
.ht-order-track:hover { background: var(--ht-primary); color: white; }
.ht-order-track svg { width: 14px; height: 14px; }

/* ─────────────── Comparison card ─────────────── */
.ht-compare {
  border: 1px solid var(--ht-border);
  border-radius: var(--ht-radius-card);
  overflow: hidden;
  background: var(--ht-bg);
}
.ht-compare-head { display: grid; padding: 10px; background: var(--ht-bg-soft); font-size: 12px; font-weight: 600; }
.ht-compare-row { display: grid; padding: 10px; border-top: 1px solid var(--ht-border-soft); font-size: 12.5px; }
.ht-compare-row:nth-child(even) { background: var(--ht-bg-soft); }
.ht-compare-attr { color: var(--ht-text-mute); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; }
.ht-compare-val { color: var(--ht-text); }
.ht-compare-val.ht-best { color: var(--ht-primary); font-weight: 600; }

/* ─────────────── Article card ─────────────── */
.ht-article-card {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--ht-border);
  border-radius: var(--ht-radius-card);
  background: var(--ht-bg);
  text-align: left;
  transition: border-color 0.15s var(--ht-ease), background 0.15s var(--ht-ease);
}
.ht-article-card:hover { border-color: var(--ht-primary); background: var(--ht-primary-tint); }
.ht-article-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ht-primary-tint);
  color: var(--ht-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ht-article-icon svg { width: 16px; height: 16px; }
.ht-article-body { flex: 1; min-width: 0; }
.ht-article-title { font-size: 13.5px; font-weight: 600; color: var(--ht-text); line-height: 1.35; }
.ht-article-snippet { font-size: 12.5px; color: var(--ht-text-soft); margin-top: 2px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ─────────────── Handoff card ─────────────── */
.ht-handoff {
  border: 1px solid var(--ht-border);
  border-radius: var(--ht-radius-card);
  padding: 16px;
  background: var(--ht-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ht-handoff-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ht-primary-tint);
  color: var(--ht-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ht-handoff-icon svg { width: 18px; height: 18px; }
.ht-handoff-head { display: flex; align-items: center; gap: 12px; }
.ht-handoff-title { font-size: 14.5px; font-weight: 700; color: var(--ht-text); }
.ht-handoff-meta { font-size: 12px; color: var(--ht-text-mute); margin-top: 1px; }
.ht-handoff-body { font-size: 13.5px; color: var(--ht-text-soft); line-height: 1.55; }
.ht-handoff-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ht-handoff-btn {
  flex: 1;
  min-width: 120px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s var(--ht-ease);
}
.ht-handoff-btn.ht-btn-wa {
  background: #25D366;
  color: white;
}
.ht-handoff-btn.ht-btn-wa:hover { background: #1da851; }
.ht-handoff-btn.ht-btn-email {
  background: var(--ht-bg-soft);
  border: 1px solid var(--ht-border);
  color: var(--ht-text);
}
.ht-handoff-btn.ht-btn-email:hover { background: var(--ht-primary-tint); border-color: var(--ht-primary); color: var(--ht-primary); }
.ht-handoff-btn svg { width: 14px; height: 14px; }

/* ─────────────── Email capture form ─────────────── */
.ht-email-form { display: flex; flex-direction: column; gap: 10px; }
.ht-email-form-label { font-size: 12.5px; color: var(--ht-text-soft); }
.ht-email-input-row { display: flex; gap: 6px; }
.ht-email-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--ht-border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--ht-text);
  background: var(--ht-bg);
  outline: none;
  transition: border-color 0.15s var(--ht-ease);
}
.ht-email-input:focus { border-color: var(--ht-primary); }
.ht-email-submit {
  padding: 10px 16px;
  background: var(--ht-primary);
  color: white;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}
.ht-email-submit:hover { background: var(--ht-primary-deep); }
.ht-email-submit:disabled { background: var(--ht-text-mute); cursor: default; }
.ht-email-success { font-size: 13px; color: var(--ht-success); display: flex; align-items: center; gap: 6px; }
.ht-email-success svg { width: 14px; height: 14px; }

/* ─────────────── Quick replies ─────────────── */
#ht-quick-replies {
  flex-shrink: 0;
  padding: 0 14px;
  background: var(--ht-bg);
  border-top: 1px solid var(--ht-border-soft);
  position: relative;
}
#ht-quick-replies:empty { display: none; }
#ht-quick-replies::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 28px;
  background: linear-gradient(to right, transparent, var(--ht-bg) 70%);
  pointer-events: none;
}

.ht-qr-row {
  display: flex;
  gap: 6px;
  padding: 10px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ht-qr-row::-webkit-scrollbar { display: none; }
.ht-qr {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1.5px solid var(--ht-primary);
  color: var(--ht-primary);
  border-radius: var(--ht-radius-pill);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--ht-bg);
  transition: background 0.15s var(--ht-ease), color 0.15s var(--ht-ease);
}
.ht-qr:hover, .ht-qr:active { background: var(--ht-primary); color: white; }

/* ─────────────── Input area ─────────────── */
#ht-input-area {
  flex-shrink: 0;
  padding: 10px 14px;
  background: var(--ht-bg);
  border-top: 1px solid var(--ht-border-soft);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
#ht-input {
  flex: 1;
  border: 1.5px solid var(--ht-border);
  border-radius: var(--ht-radius-pill);
  padding: 10px 16px;
  font-size: 16px;
  font-family: var(--ht-font);
  outline: none;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  line-height: 1.45;
  background: var(--ht-bg);
  color: var(--ht-text);
  transition: border-color 0.15s var(--ht-ease);
  scrollbar-width: none;
}
#ht-input::-webkit-scrollbar { display: none; }
#ht-input:focus { border-color: var(--ht-primary); }
#ht-input::placeholder { color: var(--ht-text-mute); }

#ht-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ht-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s var(--ht-ease), opacity 0.15s var(--ht-ease);
}
#ht-send:hover { transform: scale(1.04); }
#ht-send:active { transform: scale(0.95); }
#ht-send:disabled { opacity: 0.4; transform: none; cursor: default; }
#ht-send svg { width: 18px; height: 18px; }

/* ─────────────── Footer ─────────────── */
#ht-footer {
  flex-shrink: 0;
  text-align: center;
  padding: 6px 12px 8px;
  font-size: 10.5px;
  color: var(--ht-text-mute);
  background: var(--ht-bg);
  letter-spacing: 0.03em;
}
#ht-footer a { color: var(--ht-text-mute); }
#ht-footer a:hover { color: var(--ht-primary); }

/* ─────────────── Mobile ─────────────── */
@media (max-width: 540px) {
  #ht-launcher { bottom: 16px; right: 16px; }
  #ht-launcher.ht-launcher-icon { width: 56px; height: 56px; }
  #ht-nudge { bottom: 84px; right: 16px; max-width: calc(100vw - 32px); }

  #ht-panel {
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  #ht-header { padding-top: calc(18px + env(safe-area-inset-top, 0px)); padding-left: calc(18px + env(safe-area-inset-left, 0px)); padding-right: calc(18px + env(safe-area-inset-right, 0px)); }
  #ht-input-area { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); padding-left: calc(14px + env(safe-area-inset-left, 0px)); padding-right: calc(14px + env(safe-area-inset-right, 0px)); }
  #ht-messages { padding-left: calc(18px + env(safe-area-inset-left, 0px)); padding-right: calc(18px + env(safe-area-inset-right, 0px)); }

  .ht-product-card { width: 158px; }
  .ht-qr { padding: 9px 14px; }
  #ht-input { font-size: 16px; min-height: 46px; }
  #ht-send { width: 46px; height: 46px; }
}

@media (min-width: 541px) and (max-width: 768px) {
  #ht-panel { width: 400px; height: min(620px, calc(100vh - 110px)); }
}

/* ─────────────── Reduced motion ─────────────── */
@media (prefers-reduced-motion: reduce) {
  #ht-chatbot-widget,
  #ht-chatbot-widget * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  #ht-header { background: var(--ht-primary); }
  #ht-launcher { background: var(--ht-primary); }
  #ht-send { background: var(--ht-primary); }
  .ht-msg-bot-avatar { background: var(--ht-primary); }
}

/* ─────────────── Hidden helper ─────────────── */
.ht-hidden { display: none !important; }
.ht-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
