#uw-chat { --uwc-green: #0a7d33; --uwc-green-d: #086a2b; --uwc-bg: #fff; --uwc-fg: #16281c; --uwc-muted: #6b7a70; --uwc-line: #e3e9e4; --uwc-soft: #f4f7f5; --uwc-input: #fff;
  position: fixed; right: 16px; bottom: 16px; z-index: 2147483000; font-family: inherit; }
#uw-chat * { box-sizing: border-box; }
#uw-chat button { font-family: inherit; }
.uwc-bubble { position: relative; width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--uwc-green); color: #fff; box-shadow: 0 8px 24px rgba(10,125,51,.4), 0 2px 6px rgba(0,0,0,.2); font-size: 25px; line-height: 1; transition: transform .15s ease; }
.uwc-bubble:hover { transform: scale(1.06); }
.uwc-bubble:hover:not(.is-active) { animation: none; transform: scale(1.06); }
.uwc-bubble:focus-visible { outline: 3px solid #7fd1a0; outline-offset: 2px; }
.uwc-bubble::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--uwc-green); z-index: -1; opacity: 0; pointer-events: none; }
.uwc-bubble:not(.is-active)::before { animation: uwc-ring 2.4s ease-out infinite; }
.uwc-bubble:not(.is-active) { animation: uwc-bob 7s ease-in-out infinite; }
@keyframes uwc-ring { 0% { transform: scale(1); opacity: .45; } 70%, 100% { transform: scale(1.65); opacity: 0; } }
@keyframes uwc-bob { 0%, 82%, 100% { transform: translateY(0); } 86% { transform: translateY(-5px); } 90% { transform: translateY(0); } 94% { transform: translateY(-2px); } 97% { transform: translateY(0); } }
.uwc-badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #d92d20; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; border: 2px solid #fff; }
.uwc-badge[hidden] { display: none; }
.uwc-panel { position: fixed; right: 16px; bottom: 88px; width: min(360px, calc(100vw - 32px)); max-height: min(600px, calc(100vh - 110px));
  background: var(--uwc-bg); color: var(--uwc-fg); border-radius: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.12); display: none; flex-direction: column; overflow: hidden; font-size: 14px; }
.uwc-panel.is-open { display: flex; animation: uwc-pop .16s ease-out; }
@keyframes uwc-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.uwc-head { background: linear-gradient(135deg, var(--uwc-green), var(--uwc-green-d)); color: #fff; padding: 13px 10px 13px 16px; box-shadow: 0 1px 0 rgba(0,0,0,.08); font-weight: 600; font-size: 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.uwc-title { min-width: 0; }
.uwc-status { font-size: 12px; opacity: .9; font-weight: 400; margin-top: 2px; }
.uwc-head-actions { display: flex; align-items: center; gap: 2px; }
.uwc-head button { background: transparent; border: 0; color: #fff; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 22px; line-height: 1; }
.uwc-head button:hover { background: rgba(255,255,255,.16); }
.uwc-head button:focus-visible { outline: 2px solid #fff; }
.uwc-mute svg { width: 18px; height: 18px; }
.uwc-mute .uwc-i-off { display: none; }
.uwc-mute.is-muted .uwc-i-on { display: none; }
.uwc-mute.is-muted .uwc-i-off { display: block; }
.uwc-body { flex: 1; min-height: 120px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; background: var(--uwc-soft); }
.uwc-msg { max-width: 82%; padding: 8px 12px; border-radius: 16px; font-size: 14px; line-height: 1.4; letter-spacing: .005em; white-space: pre-wrap; overflow-wrap: anywhere; }
.uwc-msg.customer { align-self: flex-end; background: var(--uwc-green); color: #fff; border-bottom-right-radius: 5px; }
.uwc-msg.staff { align-self: flex-start; background: var(--uwc-bg); border: 1px solid var(--uwc-line); border-bottom-left-radius: 5px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.uwc-msg.system { align-self: center; max-width: 92%; text-align: center; background: transparent; color: var(--uwc-muted); font-size: 12px; padding: 4px 8px; }
.uwc-msg img { max-width: 100%; border-radius: 10px; margin-top: 6px; display: block; }
.uwc-msg img:first-child { margin-top: 0; }
.uwc-typing { align-self: flex-start; display: inline-flex; gap: 4px; align-items: center; padding: 11px 14px; background: var(--uwc-bg); border: 1px solid var(--uwc-line); border-radius: 16px; border-bottom-left-radius: 5px; }
.uwc-typing[hidden] { display: none; }
.uwc-typing span { width: 6px; height: 6px; border-radius: 50%; background: #93a399; animation: uwc-dot 1.2s infinite ease-in-out; }
.uwc-typing span:nth-child(2) { animation-delay: .15s; }
.uwc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes uwc-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
.uwc-foot { padding: 12px; border-top: 1px solid var(--uwc-line); background: var(--uwc-bg); }
.uwc-field { margin-bottom: 8px; }
.uwc-foot label { display: block; font-size: 12px; font-weight: 600; color: var(--uwc-muted); margin-bottom: 3px; }
.uwc-req { color: #d92d20; margin-left: 2px; }
.uwc-opt { font-weight: 400; opacity: .8; }
.uwc-foot input[type=text], .uwc-foot input[type=email], .uwc-foot textarea {
  width: 100%; border: 1px solid #cdd8d0; border-radius: 10px; padding: 9px 11px; font-size: 14px; font-family: inherit; background: var(--uwc-input); color: var(--uwc-fg); }
.uwc-foot input:focus, .uwc-foot textarea:focus { outline: 0; border-color: var(--uwc-green); box-shadow: 0 0 0 3px rgba(10,125,51,.18); }
.uwc-foot input.is-invalid, .uwc-foot textarea.is-invalid { border-color: #d92d20; box-shadow: 0 0 0 3px rgba(217,45,32,.12); }
.uwc-foot textarea { resize: none; line-height: 1.4; max-height: 96px; overflow-y: auto; display: block; }
.uwc-composer { display: flex; align-items: flex-end; gap: 8px; }
.uwc-composer .uwc-send { flex: none; }
.uwc-composer textarea { flex: 1; min-width: 0; }
.uwc-attach { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid #cdd8d0; background: var(--uwc-input); color: var(--uwc-muted); cursor: pointer; display: grid; place-items: center; }
.uwc-attach:hover { color: var(--uwc-green); border-color: var(--uwc-green); }
.uwc-attach:focus-visible { outline: 2px solid var(--uwc-green); outline-offset: 1px; }
.uwc-attach svg { width: 19px; height: 19px; }
.uwc-file { display: none !important; }
.uwc-preview { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 6px 8px; background: var(--uwc-soft); border: 1px solid var(--uwc-line); border-radius: 10px; }
.uwc-preview[hidden] { display: none; }
.uwc-preview img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; flex: none; }
.uwc-preview-name { flex: 1; min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uwc-preview-x { flex: none; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(0,0,0,.08); color: inherit; cursor: pointer; font-size: 16px; line-height: 1; }
.uwc-preview-x:hover { background: rgba(217,45,32,.18); }
.uwc-row { display: flex; gap: 8px; align-items: center; }
.uwc-send { background: var(--uwc-green); color: #fff; border: 0; border-radius: 10px; padding: 0 16px; height: 40px; cursor: pointer; font-size: 14px; font-weight: 600; }
.uwc-send:hover { background: var(--uwc-green-d); }
.uwc-send:disabled { opacity: .6; cursor: default; }
.uwc-send.block { width: 100%; margin-top: 2px; }
.uwc-wa { display: block; text-align: center; background: #25d366; color: #fff; text-decoration: none; padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.uwc-hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.uwc-err { color: #b3261e; font-size: 12px; margin: 0 0 8px; }
.uwc-err:empty { display: none; }
.uwc-err:not(:empty) { background: #fdecea; border-radius: 8px; padding: 6px 10px; }
/* Header end-chat control */
.uwc-head .uwc-end { width: auto; height: 28px; padding: 0 10px; margin-right: 4px; font-size: 12px; font-weight: 500; border: 1px solid rgba(255,255,255,.4); border-radius: 14px; }
.uwc-head .uwc-end.is-confirm { background: #d92d20; border-color: #d92d20; }
.uwc-closed { margin: 0 0 10px; text-align: center; color: var(--uwc-muted); font-size: 13px; }
/* Unread hairline divider */
.uwc-unread-sep { border: 0; height: 1px; background: var(--uwc-green); opacity: .55; margin: 8px 0 4px; position: relative; overflow: visible; flex: none; width: 100%; }
.uwc-unread-sep::after { content: attr(data-label); position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--uwc-soft); color: var(--uwc-green); padding: 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
/* Mobile: sit above the storefront's fixed retail/wholesale bar (~3.9rem + safe area) when it is shown */
@media (max-width: 699px) {
  #uw-chat.uwc-lift { bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px)); }
  #uw-chat.uwc-lift .uwc-panel { bottom: calc(4.4rem + 72px + env(safe-area-inset-bottom, 0px)); max-height: calc(100vh - 4.4rem - 100px); }
}
@media (max-width: 420px) { .uwc-panel { right: 8px; bottom: 82px; width: calc(100vw - 16px); } }
@media (prefers-color-scheme: dark) {
  #uw-chat { --uwc-bg: #14201a; --uwc-fg: #e7efe9; --uwc-muted: #93a399; --uwc-line: #24352b; --uwc-soft: #0e1712; --uwc-input: #0e1712; }
  .uwc-badge { border-color: #14201a; }
  .uwc-msg.staff, .uwc-typing { background: #1b2b22; border-color: #2a3d31; color: #e7efe9; }
  .uwc-foot input[type=text], .uwc-foot input[type=email], .uwc-foot textarea, .uwc-attach { border-color: #2a3d31; }
  .uwc-unread-sep::after { background: #0e1712; }
  .uwc-err:not(:empty) { background: #3a1a17; color: #ffb4ab; }
}
@media (prefers-reduced-motion: reduce) { .uwc-bubble:not(.is-active), .uwc-bubble:not(.is-active)::before, .uwc-panel.is-open, .uwc-typing span { animation: none; } }
