/* ============================================================
   TrustWeb SmartConsult Bot v3 — Frontend CSS
   Philosophy: Premium feel. Warm không lạnh. Human không robot.
   ============================================================ */

:root {
  --twsc-primary:       #2563eb;
  --twsc-primary-dark:  #1d4ed8;
  --twsc-primary-light: rgba(37,99,235,.09);
  --twsc-user-bubble:   #2563eb;
  --twsc-bg:            #f8fafc;
  --twsc-surface:       #ffffff;
  --twsc-border:        #e2e8f0;
  --twsc-text:          #111827;
  --twsc-muted:         #6b7280;
  --twsc-bot-bg:        #ffffff;
  --twsc-shadow-sm:     0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --twsc-shadow:        0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --twsc-shadow-lg:     0 24px 48px rgba(0,0,0,.13), 0 8px 20px rgba(0,0,0,.07);
  --twsc-r:             16px;
  --twsc-r-sm:          10px;
  --twsc-r-msg:         18px;
  --twsc-font:          -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --twsc-z:             2147483640;
  --twsc-ease:          cubic-bezier(.4,0,.2,1);
}

/* ── Scoped reset ── */
#twsc-root *, #twsc-portal * {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ════════════════════════════════════
   FLOATING BUBBLE
════════════════════════════════════ */
#twsc-bubble {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: var(--twsc-z);
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--twsc-primary);
  border: none; outline: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(37,99,235,.38), 0 2px 8px rgba(37,99,235,.22);
  transition: transform .18s var(--twsc-ease), box-shadow .18s var(--twsc-ease);
  -webkit-tap-highlight-color: transparent;
}
#twsc-bubble:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(37,99,235,.48), 0 3px 10px rgba(37,99,235,.28);
}
#twsc-bubble:active { transform: scale(.95); }
#twsc-bubble:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--twsc-primary) 42%, white);
  outline-offset: 3px;
}

.twsc-ico { width: 26px; height: 26px; fill: white; flex-shrink: 0; }
.twsc-ico--close { display: none; }
#twsc-bubble.is-open .twsc-ico--chat  { display: none; }
#twsc-bubble.is-open .twsc-ico--close { display: block; }

/* Notification dot */
.twsc-dot {
  display: none;
  position: absolute; top: 5px; right: 5px;
  width: 11px; height: 11px;
  background: #ef4444; border: 2px solid white; border-radius: 50%;
}
.twsc-dot--pulse { animation: twsc-pulse 2.2s ease infinite; }
@keyframes twsc-pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.25); opacity: .8; }
}

/* ════════════════════════════════════
   CHAT WINDOW
════════════════════════════════════ */
#twsc-window {
  position: fixed;
  bottom: 96px; right: 24px;
  z-index: var(--twsc-z);
  width: 384px;
  max-width: calc(100vw - 32px);
  height: min(584px, calc(100dvh - 116px));
  background: var(--twsc-surface);
  border-radius: var(--twsc-r);
  box-shadow: var(--twsc-shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  font-family: var(--twsc-font);
  font-size: 14px; color: var(--twsc-text);
  transform: translateY(18px) scale(.97);
  opacity: 0; pointer-events: none;
  transition: transform .22s var(--twsc-ease), opacity .22s var(--twsc-ease);
  will-change: transform, opacity;
}
#twsc-window.is-open {
  transform: translateY(0) scale(1);
  opacity: 1; pointer-events: all;
}

/* ── Header ── */
#twsc-header {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  background: var(--twsc-primary);
  flex-shrink: 0;
}
.twsc-header-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.twsc-header-info { flex: 1; min-width: 0; }
.twsc-header-name {
  font-size: 15px; font-weight: 700; color: white;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.twsc-header-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: rgba(255,255,255,.78); margin-top: 1px;
}
.twsc-online-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4ade80; flex-shrink: 0;
  animation: twsc-online 2.5s ease infinite;
}
@keyframes twsc-online {
  0%,100% { opacity: 1; }
  50%      { opacity: .6; }
}

/* ── Messages area ── */
#twsc-conversation {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: hidden;
  background: var(--twsc-bg);
}
#twsc-msgs {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 14px 12px; display: flex; flex-direction: column; gap: 6px;
  background: var(--twsc-bg);
  /* JS is the single owner of conversation movement. CSS smooth scrolling caused
     late scroll events to race the viewport state machine on some browsers. */
  scroll-behavior: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  scroll-padding-block: 12px 66px;
}
#twsc-msgs::-webkit-scrollbar { width: 4px; }
#twsc-msgs::-webkit-scrollbar-track { background: transparent; }
#twsc-msgs::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* Smart Conversation Viewport: progressive next-content affordance. */
#twsc-root .twsc-more {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  right: 12px;
  bottom: 10px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: calc(100% - 24px);
  min-height: 36px;
  padding: 7px 11px;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--twsc-primary) 22%, #dbe3ef);
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: #43506a;
  font: 700 11.5px/1.25 var(--twsc-font);
  letter-spacing: 0;
  text-align: center;
  box-shadow: 0 8px 24px rgba(15,23,42,.13), 0 1px 2px rgba(15,23,42,.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  opacity: 0;
  transform: translateY(7px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, border-color .16s ease, color .16s ease;
}
#twsc-root .twsc-more[hidden] { display: none !important; }
#twsc-root .twsc-more.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#twsc-root .twsc-more:hover,
#twsc-root .twsc-more:focus-visible {
  color: var(--twsc-primary);
  border-color: color-mix(in srgb, var(--twsc-primary) 45%, #dbe3ef);
  outline: none;
}
#twsc-root .twsc-more:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--twsc-primary) 18%, transparent), 0 8px 24px rgba(15,23,42,.13);
}
#twsc-root .twsc-more-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--twsc-primary-light);
  color: var(--twsc-primary);
  font-size: 13px;
  line-height: 1;
}
#twsc-root .twsc-more-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Message rows ── */
.twsc-row {
  display: flex; align-items: flex-end; gap: 8px;
}
.twsc-row--user { flex-direction: row-reverse; }
.twsc-row--grouped { margin-top: -2px; }

/* Avatar */
.twsc-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
  transition: opacity .2s;
}
.twsc-avatar-spacer { width: 30px; flex-shrink: 0; }

/* Bubbles */
.twsc-bubble {
  max-width: 78%; padding: 10px 14px;
  border-radius: var(--twsc-r-msg);
  font-size: 15px; line-height: 1.65;
  word-break: break-word; padding: 3px 10px !important;
}
.twsc-bubble--bot {
  background: var(--twsc-bot-bg);
  color: var(--twsc-text);
  border: 1px solid var(--twsc-border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--twsc-shadow-sm);
}
.twsc-bubble--user {
  background: var(--twsc-user-bubble);
  color: white;
  border-bottom-right-radius: 4px;
}
.twsc-bubble strong { font-weight: 600; color: inherit; }
.twsc-bubble em     { font-style: italic; }
/* Paragraph break — khoảng cách giữa 2 đoạn văn */
.twsc-bubble br + br { display: block; content: ''; margin-top: 6px; }

/* ── Typing indicator ── */
.twsc-typing {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 2px;
}
.twsc-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #9ca3af;
  animation: twsc-bounce 1.3s ease infinite;
}
.twsc-typing span:nth-child(2) { animation-delay: .18s; }
.twsc-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes twsc-bounce {
  0%,80%,100% { transform: translateY(0); }
  40%          { transform: translateY(-7px); }
}

/* Truthful work status: rendered only from a server SSE status event. */
#twsc-root .twsc-thinking-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #667085;
  font-size: 12.5px;
  line-height: 1.35;
  background: #f7f9fc;
  border-color: #e8edf4;
  box-shadow: none;
}
#twsc-root .twsc-thinking-state__pulse {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
#twsc-root .twsc-thinking-state__pulse i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: .42;
  animation: twsc-thinking-pulse 1.05s ease-in-out infinite;
}
#twsc-root .twsc-thinking-state__pulse i:nth-child(2) { animation-delay: .14s; }
#twsc-root .twsc-thinking-state__pulse i:nth-child(3) { animation-delay: .28s; }
@keyframes twsc-thinking-pulse {
  0%, 70%, 100% { opacity: .28; transform: translateY(0); }
  35% { opacity: .82; transform: translateY(-2px); }
}

/* ════════════════════════════════════
   PRODUCT CARDS
════════════════════════════════════ */
.twsc-cards-scroll {
  display: flex; gap: 10px;
  overflow-x: auto; padding: 4px 0 6px;
  max-width: calc(100vw - 80px);
  -ms-overflow-style: none;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.twsc-cards-scroll::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

.twsc-card {
  background: white;
  border: 1px solid var(--twsc-border);
  border-radius: 12px; overflow: hidden;
  width: 210px; flex-shrink: 0;
  box-shadow: var(--twsc-shadow-sm);
  transition: box-shadow .18s, transform .18s;
  cursor: pointer;
}
.twsc-card:hover { box-shadow: var(--twsc-shadow); transform: translateY(-2px); }

.twsc-card-img-wrap { position: relative; }
.twsc-card-img {
  width: 100%; height: 130px; object-fit: cover; display: block;
  background: #f3f4f6;
}
.twsc-card-no-img {
  width: 100%; height: 130px; display: flex;
  align-items: center; justify-content: center;
  font-size: 30px; background: linear-gradient(135deg, #ede9fe, #dbeafe);
}
.twsc-card-badges {
  position: absolute; top: 7px; left: 7px;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.twsc-badge {
  font-size: 9.5px; font-weight: 800; padding: 2px 7px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: .3px;
}
.twsc-badge--sale  { background: #fef2f2; color: #dc2626; }
.twsc-badge--stock { background: #f0fdf4; color: #16a34a; }
.twsc-badge--out   { background: #f9fafb; color: #9ca3af; }

.twsc-card-body { padding: 9px 11px 11px; }
.twsc-card-title {
  font-size: 12.5px; font-weight: 700; color: var(--twsc-text);
  line-height: 1.4; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.twsc-card-desc {
  font-size: 11.5px; color: var(--twsc-muted); line-height: 1.4; margin-bottom: 5px;
}
.twsc-card-price {
  font-size: 15px; font-weight: 800; color: var(--twsc-primary);
  margin-bottom: 8px; line-height: 1.2;
}
.twsc-card-actions { display: flex; gap: 6px; }
.twsc-card-cta {
  flex: 1; text-align: center; padding: 6px 4px;
  border-radius: 7px; font-size: 11.5px; font-weight: 700;
  text-decoration: none; border: none; cursor: pointer;
  transition: background .15s;
}
.twsc-card-cta--view {
  background: var(--twsc-primary); color: white;
}
.twsc-card-cta--view:hover { background: var(--twsc-primary-dark); }
.twsc-card-cta--cart {
  background: var(--twsc-primary-light); color: var(--twsc-primary);
  border: 1.5px solid var(--twsc-primary);
}
.twsc-card-cta--cart:hover { background: var(--twsc-primary); color: white; }

/* Stars */
.twsc-stars { display: flex; gap: 1px; margin-bottom: 3px; }
.twsc-star { font-size: 11px; color: #fbbf24; }
.twsc-star--empty { color: #e5e7eb; }

/* ════════════════════════════════════
   CTA ACTIONS
════════════════════════════════════ */
#twsc-root .twsc-cta-group {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  width: 100%; max-width: 100%;
}

#twsc-root .twsc-cta {
  box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; width: auto; max-width: 100%;
  padding: 10px 14px; border-radius: 12px;
  font: 700 12.5px/1.2 var(--twsc-font);
  white-space: nowrap; text-decoration: none; border: 1px solid transparent; cursor: pointer;
  box-shadow: 0 5px 14px rgba(15, 23, 42, .10);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
#twsc-root .twsc-cta svg {
  width: 16px; height: 16px; min-width: 16px; flex: 0 0 16px;
  display: block;
}
#twsc-root .twsc-cta:hover  { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15, 23, 42, .14); }
#twsc-root .twsc-cta:active { transform: translateY(0); }

#twsc-root .twsc-cta--zalo {
  background: linear-gradient(135deg, #0878ff, #0057d9);
  border-color: rgba(0, 82, 204, .28);
  color: #fff;
}
#twsc-root .twsc-cta--call {
  background: linear-gradient(135deg, #22a95a, #14823f);
  border-color: rgba(13, 105, 52, .28);
  color: #fff;
  box-shadow: 0 6px 16px rgba(22, 163, 74, .22);
}
#twsc-root .twsc-cta--call:hover {
  filter: brightness(1.02);
  box-shadow: 0 9px 20px rgba(22, 163, 74, .28);
}
#twsc-root .twsc-cta--form {
  background: var(--twsc-primary-light);
  color: var(--twsc-primary);
  border-color: var(--twsc-primary);
}

@media (max-width: 480px) {
  #twsc-root .twsc-cta { min-height: 44px; padding: 11px 14px; }
}

/* ready_to_convert: pulse để thu hút chú ý */
@keyframes twsc-cta-pulse {
  0%, 100% { box-shadow: var(--twsc-shadow-sm); }
  50%       { box-shadow: 0 0 0 5px rgba(0, 104, 255, 0.18), var(--twsc-shadow); }
}
.twsc-cta--pulse {
  animation: twsc-cta-pulse 1.6s ease-in-out 3;
}
@media (prefers-reduced-motion: reduce) {
  .twsc-cta--pulse { animation: none; }
}

/* Safe inline navigation links rendered as commercial CTA buttons. */
#twsc-root .twsc-bubble--bot .twsc-inline-link-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  margin: 8px 0 2px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--twsc-primary) 24%, #dbe4f0);
  border-radius: 10px;
  background: var(--twsc-primary-light);
  color: var(--twsc-primary);
  font: 700 12px/1.2 var(--twsc-font);
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
#twsc-root .twsc-bubble--bot .twsc-inline-link-cta svg { width: 14px; height: 14px; flex: 0 0 auto; }
#twsc-root .twsc-bubble--bot .twsc-inline-link-cta:hover {
  background: var(--twsc-primary);
  border-color: var(--twsc-primary);
  color: #fff;
  transform: translateY(-1px);
}
#twsc-root .twsc-bubble--bot .twsc-inline-link-cta:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--twsc-primary) 48%, white);
  outline-offset: 2px;
}

/* ════════════════════════════════════
   QUICK REPLIES
════════════════════════════════════ */
.twsc-qr-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 6px 12px 8px;
  background: var(--twsc-surface);
  border-top: 1px solid var(--twsc-border);
}
.twsc-qr-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--twsc-primary);
  background: var(--twsc-primary-light);
  color: var(--twsc-primary);
  font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: all .15s;
}
.twsc-qr-btn:hover { background: var(--twsc-primary); color: white; }

/* ════════════════════════════════════
   INPUT AREA
════════════════════════════════════ */
#twsc-input-wrap {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 9px 12px;
  background: var(--twsc-surface);
  border-top: 1px solid var(--twsc-border);
  flex-shrink: 0;
}
#twsc-input {
  flex: 1; min-height: 38px; max-height: 110px;
  padding: 9px 13px;
  border: 1.5px solid var(--twsc-border); border-radius: 20px;
  font-size: 14px; font-family: var(--twsc-font);
  color: var(--twsc-text); background: var(--twsc-bg);
  resize: none; outline: none; line-height: 1.45;
  transition: border-color .15s, box-shadow .15s;
  overflow-y: auto;
}
#twsc-input:focus {
  border-color: var(--twsc-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
#twsc-input::placeholder { color: var(--twsc-muted); }
#twsc-send {
  width: 38px; height: 38px; flex-shrink: 0;
  background: var(--twsc-primary); border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: white;
  transition: background .15s, transform .12s;
}
#twsc-send:hover  { background: var(--twsc-primary-dark); }
#twsc-send:active { transform: scale(.92); }
#twsc-send:disabled { background: #d1d5db; cursor: default; }


.twsc-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
#twsc-root button:focus-visible,
#twsc-root a:focus-visible,
#twsc-root textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--twsc-primary) 32%, transparent);
  outline-offset: 2px;
}

/* ── Footer brand ── */
.twsc-footer-brand {
  text-align: center; font-size: 10.5px; color: #9ca3af;
  padding: 4px 0 7px; background: var(--twsc-bg);
}
.twsc-footer-brand a { color: var(--twsc-primary); text-decoration: none; }

/* ════════════════════════════════════
   RESPONSIVE — MOBILE FULL SCREEN
════════════════════════════════════ */
@media (max-width: 480px) {
  #twsc-window {
    bottom: 0; right: 0; left: 0;
    width: 100%; max-width: 100%;
    height: 100dvh;
    border-radius: 0;
  }
  #twsc-bubble { bottom: 18px; right: 16px; width: 56px; height: 56px; }
}

/* ════════════════════════════════════
   REDUCED MOTION
════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  #twsc-window, #twsc-bubble, .twsc-bubble, .twsc-typing span, .twsc-thinking-state__pulse i,
  .twsc-card, .twsc-cta, .twsc-qr-btn, .twsc-dot--pulse, .twsc-online-dot {
    transition: none !important; animation: none !important;
  }
}

/* ── Phase 2: Service Card Badge ─────────────────────────────── */
.twsc-badge--group {
  background: var(--twsc-primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
}

.twsc-card--service .twsc-card-img-wrap {
  background: #f1f5f9;
}

.twsc-card--service .twsc-card-no-img {
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 100px;
  background: #f1f5f9;
}

/* ═══════════════════════════════════════════════════════════════
   v4.0.6 — Product Shelf + Modern Light Widget
   Scoped under #twsc-root so WordPress/theme CSS cannot collapse
   product cards or turn quick replies into ordinary text links.
═══════════════════════════════════════════════════════════════ */
#twsc-root {
  --twsc-bg: #f4f7fb;
  --twsc-surface: #ffffff;
  --twsc-border: #e6ebf2;
  --twsc-text: #172033;
  --twsc-muted: #718096;
  --twsc-bot-bg: #ffffff;
  --twsc-shadow-sm: 0 2px 8px rgba(15, 23, 42, .06);
  --twsc-shadow: 0 10px 28px rgba(15, 23, 42, .11);
  --twsc-shadow-lg: 0 28px 70px rgba(15, 23, 42, .18), 0 8px 24px rgba(15, 23, 42, .08);
  font-family: var(--twsc-font);
}

#twsc-root #twsc-bubble {
  width: 62px;
  height: 62px;
  right: 26px;
  bottom: 24px;
  overflow: visible;
  isolation: isolate;
  background: linear-gradient(145deg, var(--twsc-primary), var(--twsc-primary-dark));
  box-shadow: 0 12px 30px rgba(37, 99, 235, .32), 0 3px 10px rgba(15, 23, 42, .16);
}
#twsc-root #twsc-bubble::before,
#twsc-root #twsc-bubble::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--twsc-primary) 58%, transparent);
  z-index: -1;
  pointer-events: none;
}
#twsc-root #twsc-bubble:not(.is-open)::before { animation: twsc-launcher-ring 2.8s ease-out 3; }
#twsc-root #twsc-bubble:not(.is-open)::after  { animation: twsc-launcher-ring 2.8s ease-out 1.1s 3; }
#twsc-root #twsc-bubble:hover {
  transform: translateY(-2px) scale(1.045);
  box-shadow: 0 16px 36px rgba(37, 99, 235, .38), 0 5px 14px rgba(15, 23, 42, .18);
}
#twsc-root #twsc-bubble .twsc-ico { width: 25px; height: 25px; }
#twsc-root .twsc-launcher-label {
  position: absolute;
  right: 74px;
  top: 50%;
  transform: translate(6px, -50%);
  padding: 9px 13px;
  border-radius: 12px;
  background: #fff;
  color: #253044;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .14);
  font: 700 12px/1 var(--twsc-font);
  letter-spacing: -.01em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
#twsc-root .twsc-launcher-label::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  background: #fff;
  transform: translateY(-50%) rotate(45deg);
}
#twsc-root #twsc-bubble:not(.is-open).is-hinting .twsc-launcher-label,
#twsc-root #twsc-bubble:not(.is-open):hover .twsc-launcher-label,
#twsc-root #twsc-bubble:not(.is-open):focus-visible .twsc-launcher-label {
  opacity: .98;
  visibility: visible;
  transform: translate(0, -50%);
  transition-delay: 0s;
}
#twsc-root #twsc-bubble.is-open .twsc-launcher-label { opacity: 0; visibility: hidden; transform: translate(6px, -50%); }
@keyframes twsc-launcher-ring {
  0%   { transform: scale(.92); opacity: .55; }
  72%, 100% { transform: scale(1.55); opacity: 0; }
}

#twsc-root #twsc-window {
  width: 410px;
  height: min(650px, calc(100dvh - 124px));
  right: 26px;
  bottom: 100px;
  max-width: calc(100vw - 28px);
  border: 1px solid rgba(226, 232, 240, .86);
  border-radius: 22px;
  background: var(--twsc-surface);
  box-shadow: var(--twsc-shadow-lg);
  transform: translateY(20px) scale(.965);
  transform-origin: bottom right;
  transition: transform .28s cubic-bezier(.2,.85,.25,1), opacity .2s ease;
}
#twsc-root #twsc-window.is-open { transform: translateY(0) scale(1); }

#twsc-root #twsc-header {
  min-height: 66px;
  padding: 12px 14px 12px 15px;
  gap: 11px;
  background:
    radial-gradient(circle at 88% -20%, rgba(255,255,255,.28), transparent 42%),
    linear-gradient(135deg, var(--twsc-primary), var(--twsc-primary-dark));
  border-bottom: 1px solid rgba(255,255,255,.12);
}
#twsc-root .twsc-header-avatar {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
#twsc-root .twsc-header-name { font-size: 14.5px; font-weight: 750; letter-spacing: -.01em; }
#twsc-root .twsc-header-status { font-size: 11px; color: rgba(255,255,255,.82); margin-top: 2px; }
#twsc-root .twsc-online-dot { width: 7px; height: 7px; box-shadow: 0 0 0 3px rgba(74,222,128,.16); }
/* Close button is intentionally fully scoped and self-contained.
   Commercial themes often style every <button>; keep this control stable while
   still deriving its visual treatment from the configured chatbot color. */
#twsc-root #twsc-header #twsc-close.twsc-header-close {
  -webkit-appearance: none !important;
  appearance: none !important;
  box-sizing: border-box !important;
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 36px !important;
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(255,255,255,.22) !important;
  border-radius: 11px !important;
  background: var(--twsc-close-bg, var(--twsc-primary-dark)) !important;
  color: var(--twsc-close-fg, #fff) !important;
  font: inherit !important;
  line-height: 1 !important;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  box-shadow: 0 5px 14px rgba(15,23,42,.16), inset 0 1px 0 rgba(255,255,255,.12) !important;
  outline: 0 !important;
  cursor: pointer !important;
  overflow: hidden !important;
  opacity: 1 !important;
  transform: none !important;
  transition: background .16s ease, box-shadow .16s ease, transform .12s ease !important;
}
#twsc-root #twsc-header #twsc-close.twsc-header-close:hover {
  background: var(--twsc-close-hover, var(--twsc-primary)) !important;
  box-shadow: 0 7px 18px rgba(15,23,42,.2), inset 0 1px 0 rgba(255,255,255,.16) !important;
  transform: translateY(-1px) !important;
}
#twsc-root #twsc-header #twsc-close.twsc-header-close:active {
  transform: translateY(0) scale(.96) !important;
}
#twsc-root #twsc-header #twsc-close.twsc-header-close:focus-visible {
  outline: 3px solid var(--twsc-close-ring, rgba(255,255,255,.5)) !important;
  outline-offset: 2px !important;
}
#twsc-root #twsc-header #twsc-close.twsc-header-close svg {
  display: block !important;
  width: 15px !important;
  height: 15px !important;
  max-width: 15px !important;
  max-height: 15px !important;
  margin: 0 !important;
  padding: 0 !important;
  color: inherit !important;
  stroke: currentColor !important;
  flex: 0 0 15px !important;
  pointer-events: none !important;
}

#twsc-root #twsc-conversation {
  background:
    radial-gradient(circle at 50% 0, rgba(37,99,235,.045), transparent 32%),
    var(--twsc-bg);
}
#twsc-root #twsc-msgs {
  padding: 15px 13px 12px;
  gap: 8px;
  background:
    radial-gradient(circle at 50% 0, rgba(37,99,235,.045), transparent 32%),
    var(--twsc-bg);
}
#twsc-root .twsc-row { gap: 7px; }
#twsc-root .twsc-avatar,
#twsc-root .twsc-avatar-spacer { width: 28px; height: 28px; }
#twsc-root .twsc-bubble {
  max-width: 83%;
  padding: 9px 12px !important;
  border-radius: 16px;
  font-size: 16px;
  line-height: 1.58;
}
#twsc-root .twsc-bubble--bot {
  border: 1px solid #e7ecf3;
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(15,23,42,.045);
}
#twsc-root .twsc-bubble--user {
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--twsc-primary) 20%, transparent);
}
#twsc-root .twsc-card--service {
  background: #fff;
  border-color: #e5eaf1;
  color: var(--twsc-text);
}
#twsc-root .twsc-card--service .twsc-card-title { color: var(--twsc-text); }
#twsc-root .twsc-typing span { background: #aab4c3; }

/* Product shelf uses the full message width instead of being squeezed by avatar spacing. */
#twsc-root .twsc-product-shelf {
  width: 100%;
  margin: 4px 0 7px;
  padding: 10px 0 2px;
  border-top: 1px solid rgba(226,232,240,.7);
}
#twsc-root .twsc-product-shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px 9px;
}
#twsc-root .twsc-product-shelf-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #273349;
  font-size: 12.5px;
  font-weight: 750;
}
#twsc-root .twsc-product-shelf-icon { color: var(--twsc-primary); font-size: 13px; }
#twsc-root .twsc-product-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--twsc-primary-light);
  color: var(--twsc-primary);
  font-size: 10px;
  font-weight: 800;
}
#twsc-root .twsc-product-nav { display: flex; gap: 6px; }
#twsc-root .twsc-product-nav[hidden] { display: none !important; }
#twsc-root .twsc-product-nav-btn {
  appearance: none;
  width: 30px;
  height: 30px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--twsc-primary) 24%, var(--twsc-border));
  border-radius: 10px;
  background: var(--twsc-primary-light);
  color: var(--twsc-primary);
  text-decoration: none !important;
  cursor: pointer;
  box-shadow: 0 3px 9px rgba(15,23,42,.06);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease, opacity .15s ease;
}
#twsc-root .twsc-product-nav-icon {
  width: 16px;
  height: 16px;
  display: block;
  flex: 0 0 16px;
  pointer-events: none;
}
#twsc-root .twsc-product-nav-btn:hover:not(:disabled) {
  border-color: var(--twsc-primary);
  background: var(--twsc-primary);
  color: #fff;
  box-shadow: 0 5px 12px color-mix(in srgb, var(--twsc-primary) 20%, transparent);
  transform: translateY(-1px);
}
#twsc-root .twsc-product-nav-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--twsc-primary) 38%, transparent);
  outline-offset: 2px;
}
#twsc-root .twsc-product-nav-btn:disabled {
  opacity: .38;
  cursor: default;
  box-shadow: none;
}

#twsc-root .twsc-product-shelf .twsc-cards-scroll {
  width: 100%;
  max-width: 100%;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1px 2px 8px;
  scroll-snap-type: x proximity;
  scroll-padding-left: 2px;
  -ms-overflow-style: none;
  scrollbar-width: none !important;
}
#twsc-root .twsc-product-shelf .twsc-cards-scroll::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
  background: transparent !important;
}
#twsc-root .twsc-card.twsc-card--product {
  width: 238px !important;
  min-width: 238px !important;
  max-width: 238px !important;
  flex: 0 0 238px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5eaf1;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(15,23,42,.07);
  scroll-snap-align: start;
  cursor: default;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
#twsc-root .twsc-card.twsc-card--product:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--twsc-primary) 24%, #e5eaf1);
  box-shadow: 0 12px 24px rgba(15,23,42,.10);
}
#twsc-root .twsc-card--product .twsc-card-img-wrap {
  position: relative;
  display: block;
  height: 132px;
  padding: 8px;
  background: linear-gradient(180deg, #fbfcfe 0%, #f5f7fb 100%);
  text-decoration: none !important;
}
#twsc-root .twsc-card--product .twsc-card-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 9px;
  background: #fff;
}
#twsc-root .twsc-card--product .twsc-card-no-img { height: 100%; border-radius: 9px; }
#twsc-root .twsc-card--product .twsc-card-badges { top: 9px; left: 9px; }
#twsc-root .twsc-card--product .twsc-badge {
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.75);
  box-shadow: 0 2px 7px rgba(15,23,42,.08);
  font-size: 9px;
  letter-spacing: .02em;
}
#twsc-root .twsc-card--product .twsc-card-body {
  padding: 10px 11px 11px !important;
  display: flex;
  flex-direction: column;
  flex: 1;
}
#twsc-root .twsc-card-category {
  margin-bottom: 4px;
  color: var(--twsc-primary);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#twsc-root .twsc-card--product .twsc-card-title {
  min-height: 35px;
  margin: 0 0 6px !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #202b3d !important;
  font-size: 12.5px !important;
  font-weight: 720 !important;
  line-height: 1.38 !important;
  text-decoration: none !important;
}
#twsc-root .twsc-card-rating { display: flex; align-items: center; gap: 4px; min-height: 15px; margin-bottom: 5px; }
#twsc-root .twsc-card-rating .twsc-stars { margin: 0; }
#twsc-root .twsc-card-reviews { color: #8791a4; font-size: 10px; }
#twsc-root .twsc-card--product .twsc-card-price {
  margin: auto 0 9px;
  min-height: 20px;
  color: var(--twsc-primary) !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  line-height: 1.3;
}
#twsc-root .twsc-card-price del { color: #9aa3b2; font-size: 10.5px; font-weight: 500; opacity: 1; margin-right: 4px; }
#twsc-root .twsc-card-price ins { color: #e11d48; text-decoration: none; font-weight: 800; }
#twsc-root .twsc-price-contact { color: var(--twsc-muted); font-size: 12px; font-weight: 650; }
#twsc-root .twsc-card--product .twsc-card-actions { display: flex; gap: 7px; align-items: center; }
#twsc-root .twsc-card--product .twsc-card-cta {
  min-height: 34px;
  padding: 7px 10px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 9px;
  font: 700 11px/1.2 var(--twsc-font) !important;
  text-decoration: none !important;
  box-shadow: none;
}
#twsc-root .twsc-card--product .twsc-card-cta--view {
  flex: 1;
  background: var(--twsc-primary) !important;
  color: #fff !important;
  border: 1px solid var(--twsc-primary) !important;
}
#twsc-root .twsc-card--product .twsc-card-cta--cart {
  width: 34px;
  min-width: 34px;
  flex: 0 0 34px;
  padding: 0 !important;
  background: var(--twsc-primary-light) !important;
  color: var(--twsc-primary) !important;
  border: 1px solid color-mix(in srgb, var(--twsc-primary) 26%, transparent) !important;
}
#twsc-root .twsc-card--product .twsc-card-cta--cart.is-loading { opacity: .62; cursor: wait; }
#twsc-root .twsc-card--product .twsc-card-cta--cart.is-added {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border-color: #a7f3d0 !important;
}


#twsc-root #twsc-qr.twsc-qr-row {
  display: block !important;
  width: auto;
  margin: 2px 14px 10px 42px;
  padding: 9px !important;
  overflow: visible;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border: 1px solid #e5eaf2;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(31, 42, 68, .055);
}
#twsc-root #twsc-qr.twsc-qr-row:empty { display: none !important; }
#twsc-root .twsc-suggestions-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 2px 8px;
  color: #68748a;
  font: 700 10.5px/1.25 var(--twsc-font);
  letter-spacing: .01em;
}
#twsc-root .twsc-suggestions-label svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: var(--twsc-primary);
}
#twsc-root .twsc-suggestions-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
}
#twsc-root .twsc-qr-btn {
  appearance: none !important;
  min-width: 0;
  min-height: 38px;
  margin: 0 !important;
  padding: 8px 9px 8px 10px !important;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid #dfe6f0 !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: #3f4b63 !important;
  font: 650 12px/1.3 var(--twsc-font) !important;
  text-align: left;
  text-decoration: none !important;
  box-shadow: none !important;
  white-space: normal;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, transform .16s ease;
}
#twsc-root .twsc-qr-btn--primary {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--twsc-primary) 24%, #dfe6f0) !important;
  background: color-mix(in srgb, var(--twsc-primary) 5%, #fff) !important;
}
#twsc-root .twsc-qr-btn-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
#twsc-root .twsc-qr-btn-arrow {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #8290a8;
  background: #f5f7fb;
}
#twsc-root .twsc-qr-btn-arrow svg { width: 11px; height: 11px; }
#twsc-root .twsc-qr-btn:hover,
#twsc-root .twsc-qr-btn:focus-visible {
  border-color: color-mix(in srgb, var(--twsc-primary) 42%, #dfe6f0) !important;
  background: var(--twsc-primary-light) !important;
  color: var(--twsc-primary) !important;
  transform: translateY(-1px);
  outline: none;
}
#twsc-root .twsc-qr-btn:hover .twsc-qr-btn-arrow,
#twsc-root .twsc-qr-btn:focus-visible .twsc-qr-btn-arrow {
  color: var(--twsc-primary);
  background: #fff;
}

#twsc-root #twsc-input-wrap {
  gap: 7px;
  padding: 9px 10px 8px;
  background: #fff;
  border-top: 1px solid #edf0f5;
}
#twsc-root #twsc-input {
  min-height: 45px;
  max-height: 108px;
  padding: 10px 13px !important;
  border: 1px solid #dfe5ee !important;
  border-radius: 13px !important;
  background: #f8fafc !important;
  color: #273349 !important;
  font: 500 16px/1.45 var(--twsc-font) !important;
  box-shadow: none !important;
  resize: none !important;
  scrollbar-width: none;
}
#twsc-root #twsc-input:focus {
  border-color: color-mix(in srgb, var(--twsc-primary) 55%, #dfe5ee) !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px var(--twsc-primary-light) !important;
}
#twsc-root #twsc-send {
  appearance: none;
  width: 42px;
  height: 42px;
  border: 0 !important;
  border-radius: 13px !important;
  background: linear-gradient(145deg, var(--twsc-primary), var(--twsc-primary-dark)) !important;
  color: #fff !important;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--twsc-primary) 24%, transparent);
}
#twsc-root #twsc-send:hover { transform: translateY(-1px); }
#twsc-root #twsc-send:disabled { opacity: .5; filter: grayscale(.35); }
#twsc-root .twsc-footer-brand {
  padding: 0 0 7px;
  background: #fff;
  color: #a0a8b6;
  font-size: 9.5px;
}

@media (max-width: 480px) {
  #twsc-root #twsc-window {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    right: 0;
    bottom: 0;
    border: 0;
    border-radius: 0;
    transform-origin: bottom center;
  }
  #twsc-root #twsc-bubble { width: 58px; height: 58px; right: 16px; bottom: 18px; }
  #twsc-root #twsc-header #twsc-close.twsc-header-close {
    flex-basis: 40px !important;
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    border-radius: 12px !important;
  }
  #twsc-root .twsc-launcher-label { display: none; }
  #twsc-root .twsc-card.twsc-card--product {
    width: min(236px, calc(100vw - 74px)) !important;
    min-width: min(236px, calc(100vw - 74px)) !important;
    flex-basis: min(236px, calc(100vw - 74px)) !important;
  }
  #twsc-root #twsc-qr.twsc-qr-row {
    margin: 3px 12px 10px 44px;
    padding: 8px !important;
    border-radius: 13px;
  }
  #twsc-root .twsc-suggestions-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  #twsc-root .twsc-qr-btn--primary {
    grid-column: auto;
  }
  #twsc-root .twsc-qr-btn {
    min-height: 42px;
    padding: 9px 9px 9px 11px !important;
    font-size: 11.75px !important;
  }
  #twsc-root .twsc-more {
    right: 10px;
    bottom: 10px;
    min-height: 44px;
    max-width: calc(100% - 20px);
    padding: 9px 13px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #twsc-root #twsc-bubble::before,
  #twsc-root #twsc-bubble::after { animation: none !important; }
  #twsc-root .twsc-launcher-label,
  #twsc-root .twsc-more { transition: none !important; }
}

/* ── Issue 6: compact server-grounded evidence card ─────────────────────── */
#twsc-root .twsc-grounded-card {
  width: min(100%, 330px);
  padding: 11px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(31, 42, 68, .055);
  color: var(--twsc-text);
}
#twsc-root .twsc-grounded-card-top {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
}
#twsc-root .twsc-grounded-card-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--twsc-primary-light);
  color: var(--twsc-primary);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.2;
}
#twsc-root .twsc-grounded-card-title {
  margin-bottom: 7px;
  color: var(--twsc-muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}
#twsc-root .twsc-grounded-card-primary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #eef2f7;
  border-bottom: 1px solid #eef2f7;
}
#twsc-root .twsc-grounded-card-primary-label {
  color: var(--twsc-muted);
  font-size: 11px;
  font-weight: 650;
}
#twsc-root .twsc-grounded-card-primary-value {
  color: var(--twsc-primary);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
#twsc-root .twsc-grounded-card-details {
  display: grid;
  grid-template-columns: minmax(76px, auto) 1fr;
  gap: 4px 10px;
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.35;
}
#twsc-root .twsc-grounded-card-details dt {
  margin: 0;
  color: var(--twsc-muted);
  font-weight: 600;
}
#twsc-root .twsc-grounded-card-details dd {
  margin: 0;
  color: var(--twsc-text);
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}
#twsc-root .twsc-grounded-card-note {
  margin-top: 8px;
  padding: 7px 8px;
  border-radius: 9px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.4;
}
#twsc-root .twsc-grounded-card-link {
  display: inline-flex;
  margin-top: 8px;
  color: var(--twsc-primary) !important;
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1.3;
  text-decoration: none !important;
}
#twsc-root .twsc-grounded-card-link:hover { text-decoration: underline !important; }

/* ── v4.5.1: contextual product-offer confirmation ───────────────────── */
#twsc-root .twsc-offer-action-row {
  margin-top: -1px;
}
#twsc-root .twsc-offer-action-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
}
#twsc-root .twsc-offer-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid color-mix(in srgb, var(--twsc-primary) 30%, #e5e7eb);
  border-radius: 999px;
  background: color-mix(in srgb, var(--twsc-primary) 8%, #fff);
  color: var(--twsc-primary) !important;
  font: 750 11.5px/1.2 var(--twsc-font);
  text-decoration: none !important;
  box-shadow: 0 3px 10px rgba(15,23,42,.06);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
#twsc-root .twsc-offer-action:hover,
#twsc-root .twsc-offer-action:focus-visible {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--twsc-primary) 55%, #dbe3ef);
  background: color-mix(in srgb, var(--twsc-primary) 12%, #fff);
  box-shadow: 0 6px 16px rgba(15,23,42,.09);
  outline: none;
}
#twsc-root .twsc-offer-action:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--twsc-primary) 18%, transparent), 0 6px 16px rgba(15,23,42,.09);
}
#twsc-root .twsc-offer-action-arrow {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
}
#twsc-root .twsc-offer-action-arrow svg {
  width: 14px !important;
  height: 14px !important;
  display: block;
  pointer-events: none;
}
@media (max-width: 480px) {
  #twsc-root .twsc-offer-action {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 12px;
  }
}


/* ── STEP 4: host-theme isolation + action target hardening ──────────────
   Elementor/themes may ship broad `button`, `a`, `svg`, `textarea` or even `*`
   rules with !important. Protect only geometry/typography that is essential to
   the widget; do not reset or alter the host page. */
#twsc-root #twsc-bubble {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  height: 60px !important;
  min-height: 60px !important;
  max-height: 60px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  line-height: 1 !important;
}
#twsc-root #twsc-bubble .twsc-ico {
  width: 26px !important;
  height: 26px !important;
}
#twsc-root .twsc-bubble { line-height: 1.58 !important; }
#twsc-root .twsc-header-name,
#twsc-root .twsc-header-status { line-height: 1.25 !important; }

#twsc-root #twsc-send {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  padding: 0 !important;
  line-height: 1 !important;
}
#twsc-root #twsc-send svg { width: 16px !important; height: 16px !important; }

#twsc-root .twsc-product-nav-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px !important;
  min-width: 30px !important;
  max-width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  padding: 0 !important;
  border-radius: 10px !important;
  line-height: 1 !important;
}
#twsc-root .twsc-product-nav-icon,
#twsc-root .twsc-product-nav-icon svg { width: 16px !important; height: 16px !important; }

#twsc-root .twsc-card--product .twsc-card-img-wrap {
  display: block !important;
  padding: 8px !important;
  border-radius: 0 !important;
}
#twsc-root .twsc-card--product .twsc-card-title {
  padding: 0 !important;
  border-radius: 0 !important;
  line-height: 1.38 !important;
  text-decoration: none !important;
}
#twsc-root .twsc-card--product .twsc-card-category { line-height: 1.2 !important; }
#twsc-root .twsc-card--product .twsc-card-desc { line-height: 1.4 !important; }
#twsc-root .twsc-card--product .twsc-card-price { line-height: 1.3 !important; }
#twsc-root .twsc-card .twsc-card-cta {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: auto !important;
  padding: 7px 10px !important;
  border-radius: 9px !important;
  line-height: 1.2 !important;
  text-decoration: none !important;
}
#twsc-root .twsc-card--product .twsc-card-cta--cart {
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  flex: 0 0 34px !important;
  padding: 0 !important;
}
#twsc-root .twsc-card .twsc-card-cta svg { width: 16px !important; height: 16px !important; }

#twsc-root .twsc-cta {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  height: auto !important;
  padding: 10px 14px !important;
  border-radius: 12px !important;
  line-height: 1.2 !important;
  text-decoration: none !important;
}
#twsc-root .twsc-cta svg { width: 16px !important; height: 16px !important; }

#twsc-root .twsc-bubble--bot .twsc-inline-link-cta {
  display: flex !important;
  width: auto !important;
  height: auto !important;
  padding: 8px 12px !important;
  border-radius: 10px !important;
  line-height: 1.2 !important;
  text-decoration: none !important;
}
#twsc-root .twsc-bubble--bot .twsc-inline-link-cta svg { width: 14px !important; height: 14px !important; }

#twsc-root .twsc-qr-btn {
  display: flex !important;
  width: auto !important;
  height: auto !important;
  border-radius: 10px !important;
  line-height: 1.3 !important;
}
#twsc-root .twsc-qr-btn-arrow svg { width: 11px !important; height: 11px !important; }

#twsc-root .twsc-grounded-card,
#twsc-root .twsc-grounded-card-title,
#twsc-root .twsc-grounded-card-details,
#twsc-root .twsc-grounded-card-note,
#twsc-root .twsc-grounded-card-link { line-height: 1.35 !important; }
#twsc-root .twsc-grounded-card-link {
  display: inline-flex !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  border-radius: 0 !important;
  text-decoration: none !important;
}
#twsc-root .twsc-footer-brand a {
  display: inline !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  border-radius: 0 !important;
  line-height: inherit !important;
}
#twsc-root .twsc-offer-action {
  display: inline-flex !important;
  align-items: center !important;
  width: auto !important;
  height: auto !important;
  padding: 7px 11px !important;
  border-radius: 999px !important;
  line-height: 1.2 !important;
  text-decoration: none !important;
}
#twsc-root .twsc-offer-action-arrow svg { width: 14px !important; height: 14px !important; }

@media (max-width: 820px) {
  #twsc-root #twsc-header #twsc-close.twsc-header-close {
    flex-basis: 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
  }
  #twsc-root .twsc-product-nav-btn {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
  }
  #twsc-root .twsc-card .twsc-card-cta,
  #twsc-root .twsc-cta,
  #twsc-root .twsc-qr-btn,
  #twsc-root .twsc-offer-action,
  #twsc-root .twsc-bubble--bot .twsc-inline-link-cta { min-height: 44px !important; }
  #twsc-root .twsc-card--product .twsc-card-cta--cart {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    flex-basis: 44px !important;
  }
}

@media (max-width: 480px) {
  #twsc-root #twsc-bubble {
    width: 58px !important;
    min-width: 58px !important;
    max-width: 58px !important;
    height: 58px !important;
    min-height: 58px !important;
    max-height: 58px !important;
  }
  #twsc-root .twsc-cta { padding: 11px 14px !important; }
  #twsc-root .twsc-offer-action { padding: 9px 12px !important; }
}

/* Host themes sometimes force all buttons/SVGs to large fixed dimensions. */
#twsc-root .twsc-more {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: calc(100% - 24px) !important;
  height: auto !important;
  min-height: 36px !important;
  padding: 7px 11px !important;
  border-radius: 999px !important;
  font: 700 11.5px/1.25 var(--twsc-font) !important;
}
#twsc-root .twsc-header-avatar svg { width: 18px !important; height: 18px !important; }
#twsc-root .twsc-avatar svg { width: 14px !important; height: 14px !important; }

@media (max-width: 820px) {
  #twsc-root .twsc-more { min-height: 44px !important; }
}

/* Brand colors are configurable; keep primary-surface text/icons legible even
   when a light brand color is selected in admin. */
#twsc-root #twsc-bubble .twsc-ico { fill: var(--twsc-primary-fg, #fff) !important; }
#twsc-root #twsc-bubble .twsc-ico--close { stroke: var(--twsc-primary-fg, #fff) !important; }
#twsc-root .twsc-header-name,
#twsc-root .twsc-header-status { color: var(--twsc-primary-fg, #fff) !important; }
#twsc-root .twsc-header-avatar svg,
#twsc-root .twsc-avatar svg { fill: var(--twsc-primary-fg, #fff) !important; }
#twsc-root .twsc-bubble--user { color: var(--twsc-primary-fg, #fff) !important; }
#twsc-root #twsc-send { color: var(--twsc-primary-fg, #fff) !important; }
#twsc-root .twsc-card--product .twsc-card-cta--view { color: var(--twsc-primary-fg, #fff) !important; }
#twsc-root .twsc-card--product .twsc-card-cta--cart:hover,
#twsc-root .twsc-bubble--bot .twsc-inline-link-cta:hover { color: var(--twsc-primary-fg, #fff) !important; }
