/* ==========================================================================
   Carbon Repro Instant Actions Widget — v3.1.0
   Design: Intercom-style, mobile-first, SVG icons, CSS custom properties
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Hidden-state guard (applied immediately via JS before DOM is ready)
   -------------------------------------------------------------------------- */
html[data-widget-hidden="true"] .watch-menu,
html[data-widget-hidden="true"] .watch-form-popup,
html[data-widget-hidden="true"] .watch-chat-popup {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
}

/* --------------------------------------------------------------------------
   2. Keyframe animations
   -------------------------------------------------------------------------- */
@keyframes watch-slide-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

@keyframes watch-action-slide {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0);     }
}

/* --------------------------------------------------------------------------
   3. Widget root & CSS custom properties
   -------------------------------------------------------------------------- */
#watchWidget {
  /* Default color tokens — overridden by inline style from PHP */
  --watch-primary:      #126A59;
  --watch-secondary:    #0D4E41;
  --watch-accent:       #B88E52;
  --watch-panel-bg:     #ffffff;
  --watch-surface:      #F9F9F9;
  --watch-text:         #111111;
  --watch-button-text:  #ffffff;
  --watch-launcher-text:#126A59;

  position: fixed;
  bottom: 24px;
  right:  24px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  pointer-events: none;
  transition: bottom 0.3s ease;
}

/* Back-to-top coexistence */
.lqd-back-to-top.is-visible {
  z-index: 99990 !important;
}
body:has(.lqd-back-to-top.is-visible) #watchWidget {
  bottom: calc(24px + 56px + 16px);
}

/* --------------------------------------------------------------------------
   4. Pointer-events unlock for interactive children
   -------------------------------------------------------------------------- */
.watch-button,
.watch-launcher,
.watch-menu,
.watch-form-popup,
.watch-chat-popup,
#watchOverlay {
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   5. Launcher (button + label)
   -------------------------------------------------------------------------- */
.watch-launcher {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  position: relative;
}

.watch-label {
  background: #fff;
  color: var(--watch-launcher-text);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 18px rgba(0,0,0,.08);
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid var(--watch-primary);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  animation: watch-slide-in 0.5s ease-out;
}
.watch-label:hover {
  box-shadow: 0 6px 22px rgba(0,0,0,.10);
  transform: translateY(-2px);
  background: #f5f5f5;
}

.watch-button,
#watchWidget .watch-button {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--watch-primary) !important;
  color: var(--watch-button-text) !important;
  border: 0 !important;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  position: relative;
  padding: 0 !important;
  outline: none !important;
  text-decoration: none !important;
}
.watch-button:hover,
#watchWidget .watch-button:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 12px 28px rgba(0,0,0,.22);
}
.watch-button:active {
  transform: scale(0.94);
}

#watchWidget .watch-icon-chat {
  width: 28px;
  height: 28px;
  display: block;
  flex-shrink: 0;
  color: var(--watch-button-text) !important;
  stroke: currentColor !important;
  fill: none !important;
}

.watch-icon-image {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
}

.watch-unread-badge {
  position: absolute;
  top: -4px;
  right: -2px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(239,68,68,.35);
  display: none;
}
.watch-unread-badge.active {
  display: inline-block;
}

/* --------------------------------------------------------------------------
   6. Toast notification
   -------------------------------------------------------------------------- */
.watch-toast {
  position: absolute;
  right: 0;
  bottom: 78px;
  max-width: 240px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 12px 30px rgba(15,23,42,.22);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.24s ease;
  z-index: 2;
}
.watch-toast.active {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   7. Overlay
   -------------------------------------------------------------------------- */
#watchOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.2);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none !important;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 99997;
}
#watchOverlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto !important;
}

/* --------------------------------------------------------------------------
   8. Shared panel base (menu + form + chat)
   -------------------------------------------------------------------------- */
.watch-menu,
.watch-form-popup,
.watch-chat-popup {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  background: var(--watch-panel-bg);
  border-radius: 18px;
  box-shadow: 0 16px 50px rgba(0,0,0,.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  visibility: hidden;
  pointer-events: none !important;
  transition: all 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 99998;
}
.watch-menu.active,
.watch-form-popup.active,
.watch-chat-popup.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto !important;
  animation: watch-slide-in 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.watch-menu     { max-height: 720px; }
.watch-form-popup { max-height: 88vh; }
.watch-chat-popup { height: min(640px, 82vh); }

/* --------------------------------------------------------------------------
   9. Shared panel header styles
   -------------------------------------------------------------------------- */
.watch-menu-header,
.watch-form-header,
.watch-chat-header {
  background: linear-gradient(135deg, var(--watch-primary) 0%, var(--watch-secondary) 100%);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.watch-menu-title,
.watch-form-title,
.watch-chat-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-align: left;
}

/* Header icon buttons (back / close) */
.watch-menu-close-btn,
.watch-form-back-btn,
.watch-form-close-btn,
.watch-chat-back-btn,
.watch-chat-close-btn {
  appearance: none !important;
  background: rgba(255,255,255,.15) !important;
  border: 0 !important;
  color: #fff !important;
  cursor: pointer;
  border-radius: 50% !important;
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  transition: background 0.2s ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  box-shadow: none !important;
  overflow: hidden;
}
.watch-menu-close-btn:hover  { background: rgba(255,255,255,.28) !important; }
.watch-form-back-btn:hover   { background: rgba(255,255,255,.28) !important; }
.watch-form-close-btn:hover  { background: rgba(255,255,255,.28) !important; }
.watch-chat-back-btn:hover   { background: rgba(255,255,255,.28) !important; }
.watch-chat-close-btn:hover  { background: rgba(255,255,255,.28) !important; }

.watch-menu-close-btn svg,
.watch-form-back-btn svg,
.watch-form-close-btn svg,
.watch-chat-back-btn svg,
.watch-chat-close-btn svg {
  width: 20px !important;
  height: 20px !important;
  display: block !important;
  stroke: currentColor !important;
  fill: none !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.watch-brand-logo {
  width: 34px;
  height: 34px;
  min-width: 34px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255,255,255,.14);
  padding: 4px;
}

/* --------------------------------------------------------------------------
   10. Menu body & action cards
   -------------------------------------------------------------------------- */
.watch-menu-body {
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.watch-menu-action {
  display: flex;
  align-items: center;
  padding: 20px 18px;
  background: var(--watch-surface);
  border-radius: 14px;
  cursor: pointer;
  border: 1.5px solid #e8e8e8;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  gap: 16px;
  flex-shrink: 0;
  min-height: 68px;
  position: relative;
  overflow: hidden;
}
.watch-menu-action::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,.03), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}
.watch-menu-action:hover::before  { transform: translateX(100%); }
.watch-menu-action:hover {
  border-color: var(--watch-primary);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  transform: translateY(-2px);
  background: #fff;
}
.watch-menu-action:active { transform: translateY(-1px); }

.watch-action-1 { animation: watch-action-slide 0.4s ease-out 0.1s both; }
.watch-action-2 { animation: watch-action-slide 0.4s ease-out 0.2s both; }
.watch-action-3 { animation: watch-action-slide 0.4s ease-out 0.3s both; }
.watch-action-4 { animation: watch-action-slide 0.4s ease-out 0.4s both; }

.watch-action-icon {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 12px;
  background: rgba(18,106,89,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--watch-primary);
  flex-shrink: 0;
  transition: all 0.28s ease;
}
.watch-menu-action:hover .watch-action-icon {
  transform: scale(1.08);
  background: rgba(18,106,89,.14);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.watch-action-icon svg {
  width: 26px;
  height: 26px;
  transition: transform 0.28s ease;
}
.watch-menu-action:hover .watch-action-icon svg {
  transform: scale(1.12);
}

.watch-action-text { flex: 1; min-width: 0; }
.watch-action-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--watch-text);
  line-height: 1.3;
  transition: color 0.28s ease;
}
.watch-menu-action:hover .watch-action-title { color: var(--watch-primary); }

/* --------------------------------------------------------------------------
   11. Menu footer
   -------------------------------------------------------------------------- */
.watch-menu-footer {
  padding: 14px 20px;
  text-align: center;
  border-top: 1px solid #ebebeb;
  background: var(--watch-surface);
  flex-shrink: 0;
}
.watch-footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.watch-footer-icon {
  width: 16px;
  height: 16px;
  color: var(--watch-primary);
  opacity: 0.7;
  transition: all 0.3s ease;
}
.watch-menu-footer:hover .watch-footer-icon { opacity: 1; transform: scale(1.2); }
.watch-menu-footer small {
  font-size: 12px;
  color: #7f8c8d;
  font-weight: 500;
  letter-spacing: 0.3px;
}
.watch-menu-footer strong {
  color: var(--watch-primary);
  font-weight: 700;
  transition: color 0.3s ease;
}
.watch-menu-footer:hover strong { color: var(--watch-secondary); }
.watch-powered-by-link,
.watch-powered-by-link:visited { color: inherit; text-decoration: none; }
.watch-powered-by-link:hover strong { color: var(--watch-secondary) !important; }

/* --------------------------------------------------------------------------
   12. Form popup
   -------------------------------------------------------------------------- */
.watch-form-body {
  padding: 20px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  background: var(--watch-surface);
  -webkit-overflow-scrolling: touch;
}

.watch-form-fallback {
  padding: 18px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #dbeceb;
  color: #2c3e50;
}

#watchFormPopup .wpforms-container,
#watchFormPopup .wpforms-form {
  margin: 0 !important;
  margin-bottom: 0 !important;
}

/* --------------------------------------------------------------------------
   13. Chat popup — body / messages
   -------------------------------------------------------------------------- */
.watch-chat-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--watch-surface);
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* --------------------------------------------------------------------------
   14. Chat intake (lead capture)
   -------------------------------------------------------------------------- */
.watch-chat-intake {
  flex: 1;
  display: none;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 16px;
  overflow-y: auto;
  background: var(--watch-surface);
  -webkit-overflow-scrolling: touch;
}

.watch-chat-intake-card {
  width: 100%;
  background: var(--watch-panel-bg);
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(0,0,0,.06);
}
.watch-chat-intake-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--watch-text);
  font-weight: 700;
}
.watch-chat-intake-card p {
  margin: 0 0 14px;
  color: #667085;
  font-size: 13px;
  line-height: 1.5;
}

.watch-chat-intake-grid { display: grid; gap: 10px; }

.watch-chat-intake-input {
  width: 100%;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  padding: 11px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--watch-text);
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}
.watch-chat-intake-input:focus {
  outline: 0;
  border-color: var(--watch-primary);
  box-shadow: 0 0 0 3px rgba(18,106,89,.10);
}
.watch-chat-intake-textarea {
  min-height: 80px;
  resize: vertical;
}

.watch-chat-intake-consents {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(0,0,0,.06);
}

.watch-chat-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #475467;
  line-height: 1.55;
}
.watch-chat-consent input { accent-color: var(--watch-primary); margin-top: 2px; }
.watch-chat-consent-intake { font-size: 12px; color: #344054; }

.watch-chat-start-btn {
  margin-top: 14px;
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--watch-button-text);
  background: linear-gradient(145deg, var(--watch-primary), var(--watch-secondary));
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
  text-transform: none;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(0,0,0,.1);
  color: #fff !important;
}
.watch-chat-start-btn:hover:not(:disabled) { opacity: 0.92; transform: translateY(-1px); }
.watch-chat-start-btn:disabled { opacity: 1; cursor: not-allowed; }

/* Spinner inside Start Chat button while loading */
.watch-btn-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: watch-spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes watch-spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   15. Chat message bubbles
   -------------------------------------------------------------------------- */
.watch-chat-message-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  animation: watch-slide-in 0.22s ease-out;
}

.watch-chat-message-row-user { align-items: flex-end; }
.watch-chat-message-row-assistant { align-items: flex-start; }

.watch-chat-bubble {
  max-width: 70%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.watch-chat-bubble-user {
  background: var(--watch-primary);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.watch-chat-bubble-assistant {
  background: #fff;
  color: var(--watch-text);
  border: 1px solid rgba(0,0,0,.07);
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.watch-chat-bubble.watch-chat-human {
  border-color: var(--watch-accent);
  background: #fdf9f3;
}

.watch-chat-message-text { margin: 0; }

/* Rich content (product grid / links) is full-width, not inside the 70% bubble */
.watch-chat-rich {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.watch-chat-typing .watch-chat-bubble {
  padding: 10px 16px;
  min-width: 54px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.watch-chat-typing .watch-chat-bubble::before,
.watch-chat-typing .watch-chat-bubble::after,
.watch-chat-typing .watch-chat-bubble span.watch-typing-text {
  display: none;
}
.watch-chat-typing .watch-chat-bubble .watch-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: watch-typing-dot 1.2s infinite ease-in-out;
  flex-shrink: 0;
}
.watch-chat-typing .watch-chat-bubble .watch-dot:nth-child(2) { animation-delay: 0.2s; }
.watch-chat-typing .watch-chat-bubble .watch-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes watch-typing-dot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30%            { opacity: 1;    transform: translateY(-4px); }
}

/* --------------------------------------------------------------------------
   16. Product cards (grid, no horizontal scroll)
   -------------------------------------------------------------------------- */
.watch-chat-carousel {
  width: 100%;
  margin: 6px 0 0;
}

.watch-chat-cards {
  display: grid;
  gap: 10px;
  width: 100%;
  grid-auto-rows: 1fr;
}

/* 2 columns when there are multiple cards */
.watch-chat-cards-grid {
  grid-template-columns: repeat(2, 1fr);
}

/* single card stays full-width */
.watch-chat-cards-compact .watch-chat-card {
  width: 100%;
}

.watch-chat-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1.5px solid #ebebeb;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.watch-chat-card:hover {
  transform: translateY(-2px);
  border-color: var(--watch-primary);
  box-shadow: 0 8px 20px rgba(0,0,0,.10);
}

.watch-chat-card-image {
  width: 100%;
  height: 140px;
  overflow: hidden;
  background: #f4f4f4;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.watch-chat-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.watch-chat-card-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(18,106,89,.12);
  display: block;
}

.watch-chat-card-body {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.watch-chat-card-body strong {
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  color: #12212f;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.watch-chat-card-description {
  font-size: 12px;
  color: #667085;
  line-height: 1.4;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.watch-chat-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.watch-chat-card-category {
  font-size: 11px;
  color: #667085;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.watch-chat-card-body em {
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  color: var(--watch-primary);
  white-space: nowrap;
}
.watch-chat-card-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  border-radius: 8px;
  background: var(--watch-primary);
  color: var(--watch-button-text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease;
  margin-top: auto;
}
.watch-chat-card-cta:hover { background: var(--watch-secondary); }

/* --------------------------------------------------------------------------
   17. Inline link chips & contact actions
   -------------------------------------------------------------------------- */
.watch-chat-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.watch-chat-contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.watch-chat-contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--watch-primary), var(--watch-secondary));
  color: var(--watch-button-text);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(16,24,40,.08);
  color: var(--watch-button-text) !important;
}

.watch-chat-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
  border: 1.5px solid var(--watch-primary);
  color: var(--watch-primary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}
.watch-chat-link-btn:hover { background: var(--watch-primary); color: #fff !important; }

/* --------------------------------------------------------------------------
   18. Chat history panel
   -------------------------------------------------------------------------- */
.watch-chat-history {
  display: none;
  border-top: 1px solid #ebebeb;
  background: var(--watch-surface);
  padding: 10px 12px;
  max-height: 160px;
  overflow-y: auto;
  flex-shrink: 0;
}
.watch-chat-history.active { display: block; }

.watch-chat-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--watch-text);
}

.watch-chat-history-close,
.watch-chat-tool-btn {
  border: 1.5px solid #e0e0e0;
  background: #fff;
  color: #444;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.watch-chat-history-close:hover,
.watch-chat-tool-btn:hover {
  border-color: var(--watch-primary);
  color: var(--watch-primary);
}

.watch-chat-history-list { display: flex; flex-direction: column; gap: 8px; }

.watch-chat-history-item {
  text-align: left;
  border: 1.5px solid #ebebeb;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s ease;
  width: 100%;
  font: inherit;
}
.watch-chat-history-item:hover { border-color: var(--watch-primary); }
.watch-chat-history-item span,
.watch-chat-history-empty { color: #667085; font-size: 12px; }

.watch-chat-history-detail {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px dashed #d0d0d0;
  color: #344054;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   19. Chat input area — Intercom-style composer
   -------------------------------------------------------------------------- */
.watch-chat-form {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  flex-shrink: 0;
}

/* Toolbar: Previous Chats | Reset Chat */
.watch-chat-toolbar {
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 12px 0;
  border-top: 1px solid #ebebeb;
  background: #fff;
  flex-shrink: 0;
}

/* Make toolbar buttons immune to theme button styles */
#watchWidget .watch-chat-tool-btn,
#watchWidget .watch-chat-history-close {
  appearance: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  flex: 0 0 auto !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  line-height: 1 !important;
  background: var(--watch-surface) !important;
  color: var(--watch-text) !important;
  border-color: rgba(0,0,0,.10) !important;
}
#watchWidget .watch-chat-tool-btn:hover,
#watchWidget .watch-chat-history-close:hover {
  background: #fff !important;
}

/* Attachment preview area (above textarea inside composer) */
.watch-chat-attachments {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0;
}
.watch-chat-attachments.active { display: flex; }
.watch-chat-attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.10);
  background: var(--watch-surface);
  max-width: 100%;
}
.watch-chat-attachment-thumb {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
}
.watch-chat-attachment-name {
  font-size: 12px;
  color: #344054;
  font-weight: 600;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.watch-chat-attachment-remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: #667085;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.watch-chat-attachment-remove:hover {
  background: rgba(0,0,0,.06);
  color: #111;
}
.watch-chat-attachment-remove svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}

/* User-sent image bubble (thumbnail grid) */
.watch-chat-user-media {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.watch-chat-user-media a {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.10);
  background: #fff;
}
.watch-chat-user-media img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

/* Composer shell — contains textarea + action buttons side by side */
.watch-chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 24px;
  padding: 6px 6px 6px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.watch-chat-composer:focus-within {
  border-color: var(--watch-primary);
  box-shadow: 0 0 0 3px rgba(18,106,89,.10);
}

/* Textarea sits inside the composer shell, no own border */
.watch-chat-input-wrap { flex: 1; min-width: 0; }

.watch-chat-input {
  width: 100%;
  min-height: 28px;
  max-height: 120px;
  resize: none;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  padding: 5px 0 !important;
  font: inherit;
  font-size: 14px !important;
  color: var(--watch-text);
  background: transparent;
  box-sizing: border-box;
  line-height: 1.5;
  overflow-y: auto;
  display: block;
}
.watch-chat-input:focus {
  outline: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* Right-side action buttons inside the composer */
.watch-chat-composer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding-bottom: 2px;
}

/* Attachment button */
.watch-chat-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  color: #8a9ab0;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}
.watch-chat-upload-btn,
.watch-chat-upload-input,
.watch-chat-upload-status,
.watch-chat-attachments {
  display: none !important;
}
.watch-chat-upload-btn:hover {
  background: var(--watch-surface);
  color: var(--watch-primary);
}
.watch-chat-upload-btn svg { width: 18px; height: 18px; }
.watch-chat-upload-input { display: none; }

/* Upload status (inline, small) */
.watch-chat-upload-status {
  font-size: 11px;
  color: #667085;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Send button — circle icon */
.watch-chat-send {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  border: 0 !important;
  border-radius: 50% !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--watch-button-text);
  background: var(--watch-primary);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
}
.watch-chat-send svg {
  width: 16px !important;
  height: 16px !important;
  stroke: currentColor !important;
  fill: none !important;
  display: block !important;
}
.watch-chat-send:hover:not(:disabled) {
  background: var(--watch-secondary) !important;
  transform: scale(1.10);
  box-shadow: none !important;
  outline: none !important;
}
.watch-chat-send:focus { outline: none !important; box-shadow: none !important; }
.watch-chat-send:disabled { opacity: 0.55; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   20. Responsive — ≤1024px (tablet)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .watch-menu,
  .watch-form-popup,
  .watch-chat-popup {
    width: calc(100vw - 48px);
    right: 24px;
  }
}

/* --------------------------------------------------------------------------
   21. Responsive — ≤800px
   -------------------------------------------------------------------------- */
@media (max-width: 800px) {
  #watchWidget { bottom: 18px; right: 18px; }
  body:has(.lqd-back-to-top.is-visible) #watchWidget { bottom: calc(18px + 48px + 12px); }

  .watch-menu,
  .watch-form-popup,
  .watch-chat-popup {
    width: calc(100vw - 36px);
    right: 18px;
    bottom: 94px;
    max-height: 85vh;
  }
  .watch-button { width: 56px; height: 56px; }
  .watch-label  { font-size: 12px; padding: 7px 12px; }
}

/* --------------------------------------------------------------------------
   22. Responsive — ≤768px (mobile landscape / small tablet)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  #watchWidget { bottom: 16px; right: 16px; }
  body:has(.lqd-back-to-top.is-visible) #watchWidget { bottom: calc(16px + 48px + 12px); }

  .watch-menu,
  .watch-form-popup,
  .watch-chat-popup {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 90px;
    max-height: 80vh;
  }

  .watch-button     { width: 54px; height: 54px; }
  .watch-label      { font-size: 11px; padding: 6px 11px; }

  .watch-menu-header,
  .watch-chat-header,
  .watch-form-header { padding: 14px 16px; }

  .watch-menu-body  { padding: 16px 12px; gap: 12px; }
  .watch-form-body  { padding: 14px; }
  .watch-chat-body  { padding: 14px 12px; }
  .watch-chat-intake { padding: 14px 12px; }

  .watch-menu-action  { padding: 16px 14px; min-height: 60px; gap: 14px; }
  .watch-action-icon  { width: 44px; height: 44px; min-width: 44px; }
  .watch-action-icon svg { width: 22px; height: 22px; }
  .watch-action-title { font-size: 14px; }

}

/* --------------------------------------------------------------------------
   23. Responsive — ≤480px (mobile portrait — chat goes FULLSCREEN)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  #watchWidget { bottom: 14px; right: 14px; }
  body:has(.lqd-back-to-top.is-visible) #watchWidget { bottom: calc(14px + 44px + 10px); }

  /* Menu & form: near-fullscreen floating panel */
  .watch-menu,
  .watch-form-popup {
    width: calc(100vw - 28px);
    right: 14px;
    bottom: 86px;
    max-height: 82vh;
  }

  /* Chat: true fullscreen */
  .watch-chat-popup {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    bottom: 0;
    right: 0;
    border-radius: 0;
    max-height: none;
  }

  .watch-button { width: 52px; height: 52px; }
  .watch-label  { font-size: 10px; padding: 5px 10px; }

  .watch-menu-header  { padding: 14px; }
  .watch-menu-title   { font-size: 15px; }
  .watch-menu-body    { padding: 14px 10px; gap: 10px; }
  .watch-menu-action  { padding: 14px 12px; min-height: 56px; gap: 12px; }
  .watch-action-icon  { width: 40px; height: 40px; min-width: 40px; }
  .watch-action-icon svg { width: 20px; height: 20px; }
  .watch-action-title { font-size: 13px; }
  .watch-menu-footer  { padding: 12px; }

  .watch-chat-header  { padding: 14px 16px; }
  .watch-chat-title   { font-size: 15px; }
  .watch-chat-body    { padding: 12px 10px; }
  .watch-chat-intake  { padding: 12px; }

  .watch-chat-bubble { max-width: 92%; }

  .watch-chat-intake-card { padding: 14px; }
  .watch-chat-intake-card h3 { font-size: 16px; }
  .watch-chat-intake-consents { padding: 8px 10px; margin-top: 10px; }
  .watch-chat-consent-intake  { font-size: 11px; }
  .watch-chat-start-btn       { height: 44px; }

  /* Single column cards on mobile */
  .watch-chat-cards-grid {
    grid-template-columns: 1fr;
  }

  .watch-chat-tool-btn { font-size: 11px; padding: 5px 10px; }
}

/* --------------------------------------------------------------------------
   24. Third-party overrides (flatpickr, select2, lity)
   -------------------------------------------------------------------------- */
.flatpickr-calendar                       { z-index: 9999999 !important; }
.ui-timepicker-wrapper                    { z-index: 9999999 !important; }
.select2-container--open .select2-dropdown { z-index: 9999999 !important; }
.lity, .lity-wrap                         { z-index: 99999999 !important; pointer-events: auto !important; }
.lity-hide                                { pointer-events: none !important; }

/* Hide reCAPTCHA inside form popup */
.watch-form-popup .grecaptcha-badge,
.watch-form-popup .wpforms-recaptcha-container,
#watchFormPopup .g-recaptcha,
#watchFormPopup iframe[src*="recaptcha"],
#watchFormPopup textarea[name="g-recaptcha-response"] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
}