/* Stitch — help assistant widget. Scoped under #tc-helpbot-root so it never
 * leaks into host-page styles. Uses the site's own palette variables when
 * present (see assets/css/style.css) and falls back to sane defaults so the
 * widget looks right even on a page that hasn't loaded that stylesheet. */
#tc-helpbot-root {
  --hb-lime: var(--lime, #93cc33);
  --hb-lime-dark: var(--lime-dark, #5c8020);
  --hb-lime-soft: var(--lime-soft, #eef7df);
  --hb-black: var(--off-black, #1a1a1a);
  --hb-ink: var(--ink, #1b1b1b);
  --hb-gray: var(--gray, #6b6b6b);
  --hb-line: var(--line, #e2e2e2);
  --hb-bg: var(--bg, #ffffff);
  --hb-bg-soft: var(--bg-soft, #f5f5f0);
  --hb-radius: var(--radius, 14px);
  --hb-shadow-lg: var(--shadow-lg, 0 10px 40px rgba(0,0,0,.18));
  --hb-font: var(--font-body, 'Barlow', arial, sans-serif);
  position: fixed;
  z-index: 2147483000;
  inset: auto;
}
#tc-helpbot-root, #tc-helpbot-root * { box-sizing: border-box; font-family: var(--hb-font); }

/* ---------- Launcher ---------- */
.hb-launcher-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.hb-bubble {
  max-width: 240px;
  background: var(--hb-bg);
  color: var(--hb-ink);
  border: 1px solid var(--hb-line);
  border-radius: 14px;
  box-shadow: var(--hb-shadow-lg);
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.35;
  position: relative;
  animation: hb-pop .18s ease-out;
}
.hb-bubble::after {
  content: '';
  position: absolute;
  right: 22px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: var(--hb-bg);
  border-right: 1px solid var(--hb-line);
  border-bottom: 1px solid var(--hb-line);
  transform: rotate(45deg);
}
.hb-bubble-row { display: flex; align-items: flex-start; gap: 8px; }
.hb-bubble-text { flex: 1; }
.hb-bubble-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.hb-bubble-dismiss {
  border: none;
  background: transparent;
  color: var(--hb-gray);
  font-size: 12px;
  cursor: pointer;
  padding: 8px 12px;
  min-height: 36px;           /* comfortable tap target */
  border-radius: 6px;
  font-weight: 600;
}
.hb-bubble-dismiss:hover { background: var(--hb-bg-soft); color: var(--hb-ink); }

.hb-launcher-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  background: var(--hb-lime);
  box-shadow: var(--hb-shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transition: transform .15s ease;
}
.hb-launcher-btn:hover { transform: scale(1.05); }
.hb-launcher-btn:focus-visible { outline: 3px solid var(--hb-lime-dark); outline-offset: 2px; }
.hb-launcher-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hb-launcher-emoji {
  font-size: 28px;
  line-height: 1;
}
.hb-launcher-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: var(--hb-lime-dark);
  border: 2px solid var(--hb-bg);
  border-radius: 50%;
}

@keyframes hb-pop {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Panel ---------- */
.hb-panel {
  position: fixed;
  right: 20px;
  bottom: 96px;
  width: 360px;
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--hb-bg);
  border-radius: var(--hb-radius);
  box-shadow: var(--hb-shadow-lg);
  border: 1px solid var(--hb-line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2147483001;
  animation: hb-pop .16s ease-out;
}
.hb-panel[hidden], .hb-launcher-wrap[hidden] { display: none !important; }

.hb-header {
  background: var(--hb-black);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hb-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--hb-lime);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.hb-header-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hb-header-text { flex: 1; min-width: 0; }
.hb-header-title { font-weight: 700; font-size: 14.5px; font-family: var(--font-display, inherit); letter-spacing: .3px; }
.hb-header-sub { font-size: 11.5px; opacity: .75; }
.hb-close-btn {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  line-height: 1;
}
.hb-close-btn:hover { background: rgba(255,255,255,.15); }
.hb-close-btn:focus-visible { outline: 2px solid var(--hb-lime); }

.hb-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--hb-bg-soft);
}

.hb-msg { display: flex; }
.hb-msg.hb-user { justify-content: flex-end; }
.hb-msg-bubble {
  max-width: 84%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.42;
  white-space: pre-wrap;
}
.hb-msg.hb-bot .hb-msg-bubble { background: #fff; border: 1px solid var(--hb-line); color: var(--hb-ink); border-bottom-left-radius: 3px; }
.hb-msg.hb-user .hb-msg-bubble { background: var(--hb-lime); color: var(--hb-black); border-bottom-right-radius: 3px; font-weight: 600; }
.hb-msg-bubble ol, .hb-msg-bubble ul { margin: 6px 0 0 18px; padding: 0; }
.hb-msg-bubble li { margin: 2px 0; }

.hb-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hb-action-btn {
  border: 1px solid var(--hb-lime-dark);
  background: var(--hb-lime-soft);
  color: var(--hb-lime-dark);
  font-weight: 700;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.hb-action-btn:hover { background: var(--hb-lime); color: var(--hb-black); }
.hb-action-btn:focus-visible { outline: 2px solid var(--hb-lime-dark); outline-offset: 1px; }
.hb-action-btn.hb-link { border-color: var(--hb-line); background: #fff; color: var(--hb-ink); }
.hb-action-btn.hb-link:hover { background: var(--hb-bg-soft); }

.hb-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 4px; }
.hb-chip {
  border: 1px solid var(--hb-line);
  background: #fff;
  color: var(--hb-ink);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
}
.hb-chip:hover { border-color: var(--hb-lime-dark); background: var(--hb-lime-soft); }
.hb-chip:focus-visible { outline: 2px solid var(--hb-lime-dark); }

.hb-typing { display: inline-flex; gap: 3px; padding: 2px 0; }
.hb-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--hb-gray);
  animation: hb-blink 1.1s infinite ease-in-out;
}
.hb-typing span:nth-child(2) { animation-delay: .15s; }
.hb-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes hb-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.hb-inputbar {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--hb-line);
  background: #fff;
}
.hb-input {
  flex: 1;
  border: 1px solid var(--hb-line);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
}
.hb-input:focus { border-color: var(--hb-lime-dark); }
.hb-send-btn {
  border: none;
  background: var(--hb-lime);
  color: var(--hb-black);
  font-weight: 700;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hb-send-btn:hover { background: var(--hb-lime-dark); color: #fff; }
.hb-send-btn:focus-visible { outline: 2px solid var(--hb-lime-dark); outline-offset: 2px; }
.hb-send-btn:disabled { opacity: .5; cursor: default; }

/* ---------- Highlight overlay ---------- */
.hb-highlight-outline {
  position: fixed;
  z-index: 2147483002;
  border: 3px solid var(--hb-lime);
  border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(147,204,51,.35), 0 0 18px rgba(147,204,51,.6);
  pointer-events: none;
  animation: hb-pulse 1.1s infinite;
}
.hb-highlight-label {
  position: fixed;
  z-index: 2147483003;
  background: var(--hb-black);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--hb-shadow-lg);
}
@keyframes hb-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(147,204,51,.35), 0 0 18px rgba(147,204,51,.6); }
  50% { box-shadow: 0 0 0 6px rgba(147,204,51,.15), 0 0 26px rgba(147,204,51,.9); }
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .hb-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 88vh;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
  }
  .hb-launcher-wrap { right: 14px; bottom: 14px; }
  .hb-bubble { max-width: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  .hb-bubble, .hb-panel, .hb-highlight-outline { animation: none; }
}

/* ---------- Session status (staff) ---------- */
.hb-header-status {
  display: inline-block;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--hb-black);
  background: var(--hb-lime);
  border-radius: 999px;
  padding: 1px 8px;
}
.hb-header-status[hidden] { display: none; }

/* ---------- Product finder cards (ported from the retired assist.js) ---------- */
.hb-cards { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; white-space: normal; }
.hb-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--hb-line);
  border-radius: 10px;
  background: #fff;
  color: var(--hb-ink);
  text-decoration: none;
  transition: border-color .12s, background .12s;
}
.hb-card:hover { border-color: var(--hb-lime-dark); background: var(--hb-lime-soft); }
.hb-card:focus-visible { outline: 2px solid var(--hb-lime-dark); outline-offset: 1px; }
.hb-card img { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; background: var(--hb-bg-soft); flex-shrink: 0; }
.hb-card-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.hb-card-text b { font-size: 12.5px; }
.hb-card-text span { font-size: 11.5px; color: var(--hb-gray); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-note { margin-top: 8px; font-size: 12px; color: var(--hb-gray); white-space: normal; }

/* ---------- Voice input ---------- */
.hb-mic-btn {
  border: 1px solid var(--hb-line);
  background: var(--hb-bg-soft);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hb-mic-btn:focus-visible { outline: 2px solid var(--hb-lime-dark); outline-offset: 2px; }
.hb-mic-btn.hb-rec { background: #d93a3a; border-color: #d93a3a; color: #fff; animation: hb-blink 1s infinite; }

/* ---------- Cookie bar (style.css lifts the launcher to 84px / 128px) — lift the open panel with it ---------- */
@media (min-width: 481px) {
  body:has(.cookie-bar) .hb-panel { bottom: 160px; max-height: calc(100vh - 184px); }
}
