/* AutoSync website live chat widget (loaded only when chat is enabled). Accent color: --asc-color (Live Chat settings). */
.asc { --asc-color: #1565C0; --asc-ink: #0F172A; --asc-muted: #64748B; --asc-border: #E2E8F0; --asc-bg: #F6F8FB;
  position: fixed; bottom: 20px; z-index: 2147483000; font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px; line-height: 1.45; color: var(--asc-ink); }
.asc-right { right: 20px; }
.asc-left { left: 20px; }
.asc *, .asc *::before, .asc *::after { box-sizing: border-box; }
.asc [hidden] { display: none !important; }

/* launcher */
.asc-launcher { position: relative; display: inline-flex; align-items: center; gap: 10px; height: 56px; padding: 0 22px 0 18px; border: 0; border-radius: 999px; background: var(--asc-color); color: #fff;
  font: inherit; font-weight: 650; font-size: 15px; cursor: pointer; box-shadow: 0 10px 28px rgba(15, 23, 42, .28), 0 2px 6px rgba(15, 23, 42, .18); transition: transform .15s ease, box-shadow .15s ease; }
.asc-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(15, 23, 42, .32), 0 2px 6px rgba(15, 23, 42, .18); }
.asc-launcher:focus-visible { outline: 3px solid rgba(255, 255, 255, .9); outline-offset: 2px; box-shadow: 0 0 0 6px var(--asc-color); }
.asc-launcher-icon { display: inline-flex; }
.asc-left .asc-launcher { float: left; }
.asc-right .asc-launcher { float: right; }
.asc.is-open .asc-launcher-text { display: none; }
.asc.is-open .asc-launcher { width: 56px; padding: 0; justify-content: center; }
.asc-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #DC2626; color: #fff; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; border: 2px solid #fff; }

/* panel */
.asc-panel { position: absolute; bottom: 72px; width: 380px; max-width: calc(100vw - 32px); height: min(620px, calc(100vh - 110px)); display: flex; flex-direction: column;
  background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 24px 60px rgba(15, 23, 42, .28), 0 4px 14px rgba(15, 23, 42, .12); animation: asc-in .18s ease-out; }
.asc-right .asc-panel { right: 0; }
.asc-left .asc-panel { left: 0; }
@keyframes asc-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.asc-head { display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 18px; background: var(--asc-color); color: #fff; }
.asc-head-text { flex: 1; min-width: 0; }
.asc-head-text strong { display: block; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asc-status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; opacity: .92; }
.asc-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }
.asc.is-offline .asc-status::before { background: #FBBF24; }
.asc-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: rgba(255, 255, 255, .18); }
.asc-avatar-icon { display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.asc-close { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.asc-close:hover, .asc-close:focus-visible { background: rgba(255, 255, 255, .16); outline: none; }

.asc-body { flex: 1; overflow-y: auto; padding: 16px; background: var(--asc-bg); display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.asc-loading { color: var(--asc-muted); text-align: center; padding: 30px 10px; }

/* messages */
.asc-msg { display: flex; flex-direction: column; max-width: 86%; }
.asc-msg-me { align-self: flex-end; align-items: flex-end; }
.asc-msg-agent { align-self: flex-start; }
.asc-bubble { padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; background: #fff; border: 1px solid var(--asc-border); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.asc-msg-agent .asc-bubble { border-top-left-radius: 4px; }
.asc-msg-me .asc-bubble { background: var(--asc-color); color: #fff; border-color: transparent; border-top-right-radius: 4px; }
.asc-msg-ai .asc-bubble { background: #F5F3FF; border-color: #E4DCFD; }
.asc-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 2px 3px; font-size: 11.5px; color: var(--asc-muted); }
.asc-who { font-weight: 650; color: #334155; }
.asc-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 9px; font-size: 10.5px; font-weight: 700; letter-spacing: .01em; }
.asc-tag-ai { background: #EDE9FE; color: #6D28D9; }
.asc-tag-human { background: #DCFCE7; color: #15803D; }
.asc-msg-system { align-self: center; max-width: 94%; }
.asc-sys { font-size: 12px; color: var(--asc-muted); text-align: center; background: #EEF2F7; border-radius: 10px; padding: 6px 10px; }
.asc-msg-greeting { max-width: 92%; }

.asc-typing { display: flex; align-items: center; gap: 8px; padding: 6px 18px 8px; font-size: 12px; color: var(--asc-muted); background: var(--asc-bg); }
.asc-dots { display: inline-flex; gap: 3px; }
.asc-dots i { width: 6px; height: 6px; border-radius: 50%; background: #94A3B8; animation: asc-dot 1.2s infinite ease-in-out; }
.asc-dots i:nth-child(2) { animation-delay: .15s; }
.asc-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes asc-dot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* forms */
.asc-form { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid var(--asc-border); border-radius: 12px; padding: 14px; }
.asc-field label { display: block; font-size: 12.5px; font-weight: 600; color: #334155; margin-bottom: 4px; }
.asc-opt { font-weight: 400; color: var(--asc-muted); }
.asc-field input, .asc-field textarea, .asc-input { width: 100%; font: inherit; font-size: 16px; color: var(--asc-ink); background: #fff; border: 1px solid #CBD5E1; border-radius: 10px; padding: 9px 11px; outline: none; resize: none; }
.asc-field input:focus, .asc-field textarea:focus, .asc-input:focus { border-color: var(--asc-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--asc-color) 22%, transparent); }
.asc-err, .asc-form-err, .asc-send-err { color: #B91C1C; font-size: 12px; margin-top: 4px; }
.asc-send-err { padding: 0 14px; }
.asc-btn { height: 44px; border: 0; border-radius: 10px; background: var(--asc-color); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.asc-btn:disabled { opacity: .65; cursor: default; }
.asc-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.asc-offline-note { background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 12px; padding: 12px 14px; }
.asc-offline-note p { margin: 4px 0 0; color: #57534E; }

.asc-foot { background: #fff; border-top: 1px solid var(--asc-border); }
.asc-foot:empty { display: none; }
.asc-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; }
.asc-input { flex: 1; min-height: 42px; max-height: 120px; }
.asc-send { flex: 0 0 42px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--asc-color); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.asc-send:focus-visible, .asc-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--asc-color) 40%, transparent); outline-offset: 2px; }

/* phones: full screen */
@media (max-width: 520px) {
  .asc { bottom: 16px; }
  .asc-right { right: 16px; }
  .asc-left { left: 16px; }
  .asc-launcher { height: 54px; padding: 0 18px 0 16px; font-size: 14px; }
  .asc.is-open { inset: 0; bottom: 0; right: 0; left: 0; }
  .asc.is-open .asc-launcher { display: none; }
  .asc-panel { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100%; height: 100dvh; border-radius: 0; bottom: 0; animation: none; }
  .asc-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .asc-composer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  html.asc-lock, html.asc-lock body { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .asc-panel, .asc-launcher, .asc-dots i { animation: none; transition: none; } }
@media print { .asc { display: none; } }
