/* SureHelp sales chat (public site). Colours follow the visitor's site theme (site-themes.css). */
.sales-chat { --sc-1: var(--site-primary, #4f46e5); --sc-2: var(--site-secondary, #7c3aed); --sc-rgb: var(--site-primary-rgb, 79, 70, 229);
  --sc-ink: #0f172a; --sc-muted: #64748b; --sc-line: #e2e8f0; --sc-soft: #f1f5f9;
  font-family: inherit; color: var(--sc-ink); }
body.has-sales-chat .back-to-top { bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important; right: 26px !important; }
body.has-sales-chat .floating-roi-btn { bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important; }
/* Phones: chat and the ROI button already fill the corner; back-to-top would sit on top of them. */
@media (max-width: 767.98px) { body.has-sales-chat .back-to-top { display: none !important; } }

.sales-chat__launcher { position: fixed; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 1060;
  width: 60px; height: 60px; border: 0; border-radius: 50%; cursor: pointer; color: #fff; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--sc-1), var(--sc-2)); box-shadow: 0 12px 30px rgba(var(--sc-rgb), .45), 0 2px 6px rgba(0,0,0,.18);
  transition: transform .2s ease, box-shadow .2s ease; }
.sales-chat__launcher:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 16px 36px rgba(var(--sc-rgb), .55); }
.sales-chat__launcher:focus-visible, .sales-chat button:focus-visible, .sales-chat textarea:focus-visible, .sales-chat input:focus-visible { outline: 3px solid rgba(var(--sc-rgb), .55); outline-offset: 2px; }
.sales-chat__launcher svg { width: 28px; height: 28px; }
.sales-chat__icon-close { display: none; }
.sales-chat.is-open .sales-chat__icon-open { display: none; }
.sales-chat.is-open .sales-chat__icon-close { display: block; }
.sales-chat__dot { position: absolute; top: 6px; right: 6px; width: 13px; height: 13px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }

.sales-chat__teaser { position: fixed; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 1059;
  display: flex; align-items: flex-start; gap: 6px; max-width: 270px; padding: 12px 10px 12px 14px; border-radius: 16px 16px 4px 16px;
  background: #fff; box-shadow: 0 14px 34px rgba(15, 23, 42, .22); animation: sc-pop .35s ease both; }
.sales-chat__teaser-text { border: 0; background: none; padding: 0; text-align: left; font-size: 14px; line-height: 1.4; color: var(--sc-ink); cursor: pointer; font-weight: 500; }
.sales-chat__teaser-close { border: 0; background: none; color: var(--sc-muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }

.sales-chat__panel { position: fixed; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 1061;
  width: 384px; height: min(640px, calc(100vh - 120px)); display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 22px; box-shadow: 0 24px 60px rgba(15, 23, 42, .32), 0 0 0 1px rgba(15, 23, 42, .06);
  transform-origin: bottom right; animation: sc-pop .22s ease both; }
.sales-chat__panel[hidden], .sales-chat__teaser[hidden] { display: none; }
.sales-chat__header { display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 16px; color: #fff;
  background: linear-gradient(135deg, var(--site-hero-1, #1e3a8a), var(--sc-1) 55%, var(--sc-2)); }
.sales-chat__avatar { width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.95); padding: 4px; object-fit: contain; }
.sales-chat__who { flex: 1; min-width: 0; }
.sales-chat__title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.2; }
.sales-chat__status { margin: 2px 0 0; font-size: 12.5px; opacity: .9; display: flex; align-items: center; gap: 6px; }
.sales-chat__online { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .25); }
.sales-chat__close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center; cursor: pointer; }
.sales-chat__close:hover { background: rgba(255,255,255,.26); }
.sales-chat__close svg { width: 18px; height: 18px; }
.sales-chat__debug { margin: 0; padding: 8px 16px; font-size: 12px; line-height: 1.4; color: #92400e; background: #fef3c7; border-bottom: 1px solid #fcd34d; }
.sales-chat__disclosure { margin: 0; padding: 8px 16px; font-size: 12px; line-height: 1.4; color: var(--sc-muted); background: var(--sc-soft); border-bottom: 1px solid var(--sc-line); }

.sales-chat__log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; background: #fbfcfe; overscroll-behavior: contain; }
.sales-chat__log:focus { outline: none; }
.sc-msg { max-width: 84%; display: flex; flex-direction: column; gap: 3px; }
.sc-msg--you { align-self: flex-end; align-items: flex-end; }
.sc-msg__who { font-size: 11px; font-weight: 600; color: var(--sc-muted); padding: 0 4px; }
.sc-msg__bubble { padding: 10px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.sc-msg--assistant .sc-msg__bubble, .sc-msg--team .sc-msg__bubble { background: #fff; border: 1px solid var(--sc-line); border-bottom-left-radius: 5px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.sc-msg--team .sc-msg__bubble { border-color: rgba(var(--sc-rgb), .35); }
.sc-msg--you .sc-msg__bubble { color: #fff; background: linear-gradient(135deg, var(--sc-1), var(--sc-2)); border-bottom-right-radius: 5px; }
.sc-msg__bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.sc-msg--assistant .sc-msg__bubble a, .sc-msg--team .sc-msg__bubble a { color: var(--sc-1); }
.sc-msg__time { font-size: 10.5px; color: #94a3b8; padding: 0 4px; }

.sc-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; border-radius: 16px; border-bottom-left-radius: 5px; background: #fff; border: 1px solid var(--sc-line); }
.sc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: sc-bounce 1.2s infinite ease-in-out; }
.sc-typing span:nth-child(2) { animation-delay: .15s; } .sc-typing span:nth-child(3) { animation-delay: .3s; }

.sc-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 4px; }
.sc-chip { border: 1px solid rgba(var(--sc-rgb), .4); background: #fff; color: var(--sc-1); border-radius: 999px; padding: 7px 13px; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.sc-chip:hover { background: var(--sc-1); color: #fff; }
.sc-chip[aria-pressed="true"] { background: var(--sc-1); color: #fff; }
.sc-chip:disabled { opacity: .5; cursor: default; }

.sc-card { align-self: stretch; background: #fff; border: 1px solid var(--sc-line); border-radius: 16px; padding: 12px; box-shadow: 0 2px 10px rgba(15,23,42,.05); }
.sc-card__title { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--sc-ink); }
.sc-card__note { margin: 6px 0 0; font-size: 12px; color: var(--sc-muted); }
.sc-days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; scrollbar-width: thin; }
.sc-day { flex: 0 0 auto; border: 1px solid var(--sc-line); background: var(--sc-soft); color: var(--sc-ink); border-radius: 10px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.sc-day[aria-selected="true"] { background: var(--sc-1); border-color: var(--sc-1); color: #fff; }
.sc-times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sc-time { border: 1px solid rgba(var(--sc-rgb), .35); background: #fff; color: var(--sc-1); border-radius: 10px; padding: 8px 4px; font-size: 13px; font-weight: 600; cursor: pointer; }
.sc-time:hover { background: rgba(var(--sc-rgb), .08); }
.sc-time:disabled { opacity: .5; cursor: default; }

.sc-form { display: grid; gap: 8px; }
.sc-field { display: grid; gap: 3px; }
.sc-field label { font-size: 12px; font-weight: 600; color: var(--sc-ink); }
.sc-field input { width: 100%; border: 1px solid var(--sc-line); border-radius: 10px; padding: 9px 11px; font-size: 14px; color: var(--sc-ink); background: #fff; }
.sc-field input[aria-invalid="true"] { border-color: #ef4444; }
.sc-field__error { font-size: 12px; color: #dc2626; }
.sc-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 11.5px; line-height: 1.4; color: var(--sc-muted); }
.sc-consent input { margin-top: 2px; flex: 0 0 auto; }
.sc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.sc-primary { border: 0; border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 700; color: #fff; cursor: pointer; background: linear-gradient(135deg, var(--sc-1), var(--sc-2)); }
.sc-primary:disabled { opacity: .6; cursor: default; }

.sc-booked { align-self: stretch; border-radius: 16px; padding: 14px; color: #fff; background: linear-gradient(135deg, #059669, #0d9488); box-shadow: 0 8px 20px rgba(5,150,105,.25); }
.sc-booked__title { margin: 0; font-size: 13px; font-weight: 600; opacity: .9; }
.sc-booked__when { margin: 4px 0 0; font-size: 16px; font-weight: 800; }
.sc-booked__note { margin: 6px 0 0; font-size: 12px; opacity: .9; }

.sales-chat__error { margin: 0; padding: 8px 14px; font-size: 13px; color: #b91c1c; background: #fef2f2; border-top: 1px solid #fecaca; }
.sales-chat__error button { border: 0; background: none; color: #b91c1c; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }
.sales-chat__error[hidden] { display: none; }
.sales-chat__composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--sc-line); background: #fff; }
.sales-chat__composer textarea { flex: 1; resize: none; border: 1px solid var(--sc-line); border-radius: 14px; padding: 10px 12px; font-size: 14.5px; line-height: 1.4; max-height: 120px; color: var(--sc-ink); background: var(--sc-soft); font-family: inherit; }
.sales-chat__composer textarea:focus { background: #fff; border-color: rgba(var(--sc-rgb), .5); outline: none; }
.sales-chat__send { width: 42px; height: 42px; flex: 0 0 auto; border: 0; border-radius: 50%; color: #fff; cursor: pointer; display: grid; place-items: center; background: linear-gradient(135deg, var(--sc-1), var(--sc-2)); }
.sales-chat__send:disabled { opacity: .5; cursor: default; }
.sales-chat__send svg { width: 19px; height: 19px; }
.sales-chat__foot { margin: 0; padding: 0 12px 10px; font-size: 11px; color: #94a3b8; background: #fff; text-align: center; }
.sales-chat__foot a { color: inherit; }

@keyframes sc-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes sc-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

@media (max-width: 520px) {
  .sales-chat__panel { inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
  .sales-chat.is-open .sales-chat__launcher { display: none; }
  .sales-chat__launcher { width: 56px; height: 56px; }
  .sales-chat__teaser { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .sales-chat *, .sales-chat__launcher, .sales-chat__panel, .sales-chat__teaser { animation: none !important; transition: none !important; }
}
.sc-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; }
.sales-chat, .sales-chat *, .sales-chat *::before, .sales-chat *::after { box-sizing: border-box; }
.sales-chat p { margin-top: 0; }
