/* SMATE chat widget + inbox (storefront and Seller Centre) */
:root { --cw-ink: #0B1B3F; --cw-sun: #F7A51C; --cw-sun2: #FF7A1A; --cw-bg: #F6F4EF; --cw-line: #E7E3DA; }
/* ── floating button ── */
.cw { position: fixed; right: 22px; bottom: 22px; z-index: 120; font-family: 'Manrope', system-ui, sans-serif; }
.cw-fab { width: 62px; height: 62px; border-radius: 50%; border: 0; cursor: pointer; background: var(--cw-ink); color: #fff; font-size: 24px;
  box-shadow: 0 12px 30px rgba(11,27,63,.35); display: grid; place-items: center; position: relative; transition: transform .2s; }
.cw-fab:hover { transform: translateY(-2px) scale(1.03); }
.cw-fab::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--cw-sun); opacity: .6; animation: cwpulse 2.4s infinite; }
@keyframes cwpulse { 0% { transform: scale(.9); opacity: .7 } 70% { transform: scale(1.18); opacity: 0 } 100% { opacity: 0 } }
.cw-fab .spark { position: absolute; top: 9px; right: 11px; font-size: 11px; color: var(--cw-sun); }
.cw-fab .ic-close { display: none; } .cw.open .cw-fab .ic-open, .cw.open .cw-fab .spark { display: none; } .cw.open .cw-fab .ic-close { display: inline-block; } .cw-dot[hidden] { display: none; }
.cw-dot { position: absolute; top: -2px; left: -2px; background: #E5484D; color: #fff; font-size: 11px; font-weight: 800; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; border: 2px solid #fff; }
.cw-label { position: absolute; right: 74px; bottom: 14px; background: #fff; color: var(--cw-ink); font-weight: 700; font-size: 13px; padding: 8px 14px; border-radius: 99px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.cw.open .cw-label { display: none; }
/* ── panel ── */
.cw-panel { position: absolute; right: 0; bottom: 78px; width: 390px; height: min(600px, calc(100vh - 120px)); background: #fff; border-radius: 24px;
  box-shadow: 0 24px 60px rgba(11,27,63,.28); display: none; flex-direction: column; overflow: hidden; }
.cw.open .cw-panel { display: flex; animation: cwin .22s ease; }
@keyframes cwin { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.cw-top { background: radial-gradient(circle at 90% 0%, #2A4790 0%, var(--cw-ink) 60%); color: #fff; padding: 16px 18px 0; }
.cw-top .row { display: flex; align-items: center; gap: 10px; }
.cw-top .mark { width: 38px; height: 38px; border-radius: 12px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.cw-top .mark img { width: 32px; }
.cw-top b { font-family: 'Sora', sans-serif; font-size: 16px; display: block; } .cw-top small { opacity: .75; font-size: 12px; }
.cw-top .x { margin-left: auto; background: rgba(255,255,255,.12); border: 0; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; }
.cw-tabs { display: flex; gap: 6px; margin-top: 14px; }
.cw-tabs button { flex: 1; background: transparent; border: 0; color: rgba(255,255,255,.7); padding: 10px; font-weight: 700; font-size: 13.5px; cursor: pointer; border-radius: 12px 12px 0 0; font-family: inherit; }
.cw-tabs button.active { background: #fff; color: var(--cw-ink); }
.cw-view { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--cw-bg); }
.cw-view[hidden] { display: none; }
/* ── messages ── */
.thread-msgs, [data-ai-msgs] { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; flex-direction: column; max-width: 86%; }
.msg .bubble { padding: 10px 13px; border-radius: 16px; font-size: 14px; line-height: 1.45; word-wrap: break-word; }
.msg.them { align-self: flex-start; } .msg.them .bubble { background: #fff; border: 1px solid var(--cw-line); border-bottom-left-radius: 4px; color: #222; }
.msg.me { align-self: flex-end; align-items: flex-end; } .msg.me .bubble { background: var(--cw-ink); color: #fff; border-bottom-right-radius: 4px; }
.msg.sys { align-self: center; max-width: 92%; align-items: center; } .msg.sys .bubble { background: #FFF1D6; color: #7A4B00; font-size: 12.5px; border-radius: 12px; text-align: center; }
.msg time { font-size: 10.5px; color: #8A8F9C; margin-top: 3px; padding: 0 4px; }
.msg.ai { max-width: 100%; }
.msg-product { display: flex; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--cw-line); border-radius: 12px; padding: 6px; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--cw-ink); text-decoration: none; }
.msg-product img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: var(--cw-bg); }
.typing { display: flex; gap: 4px; padding: 13px 14px !important; } .typing i { width: 7px; height: 7px; border-radius: 50%; background: #B9BDC7; animation: tdot 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s } .typing i:nth-child(3) { animation-delay: .3s }
@keyframes tdot { 0%,80%,100% { transform: translateY(0); opacity: .5 } 40% { transform: translateY(-4px); opacity: 1 } }
.thread-form, .ai-form { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--cw-line); }
.thread-form input, .ai-form input { flex: 1; border: 1px solid var(--cw-line); background: var(--cw-bg); border-radius: 99px; padding: 11px 16px; font: inherit; font-size: 14px; outline: none; }
.thread-form input:focus, .ai-form input:focus { border-color: var(--cw-sun); background: #fff; }
.thread-form button, .ai-form button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--cw-sun), var(--cw-sun2)); color: #fff; cursor: pointer; font-size: 15px; flex-shrink: 0; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #fff; border-bottom: 1px solid var(--cw-line); }
.thread-head .t-title b { display: block; font-size: 14.5px; } .thread-head small a { color: #1A73E8; font-size: 12px; text-decoration: none; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--cw-line); background: #fff; cursor: pointer; }
/* AI product cards */
.ai-products { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px 4px; scroll-snap-type: x mandatory; }
.ai-card { flex: 0 0 150px; background: #fff; border-radius: 14px; border: 1px solid var(--cw-line); padding: 8px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 3px; position: relative; }
.ai-card a { color: inherit; text-decoration: none; }
.ai-card img { width: 100%; height: 96px; object-fit: contain; background: var(--cw-bg); border-radius: 10px; }
.ai-card b { font-size: 12.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
.ai-card .pr { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 13.5px; color: var(--cw-ink); } .ai-card s { color: #999; font-size: 11px; font-weight: 400; }
.ai-card small { font-size: 11px; color: #7A7F8C; }
.ai-card .plan { position: absolute; top: 12px; left: 12px; background: var(--cw-ink); color: var(--cw-sun); font-style: normal; font-size: 9.5px; font-weight: 800; padding: 2px 6px; border-radius: 6px; text-transform: uppercase; }
.ai-card button { margin-top: 4px; border: 1px solid var(--cw-line); background: #fff; border-radius: 99px; padding: 5px; font-size: 11.5px; font-weight: 700; cursor: pointer; color: var(--cw-ink); font-family: inherit; }
.ai-link { align-self: flex-start; font-size: 13px; font-weight: 700; color: #E07A00; text-decoration: none; margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips button { border: 1px solid var(--cw-line); background: #fff; border-radius: 99px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--cw-ink); font-family: inherit; }
.chips button:hover { border-color: var(--cw-sun); background: #FFF6E6; }
/* conversation list */
.conv { display: flex; gap: 10px; align-items: center; width: 100%; padding: 12px 14px; background: #fff; border: 0; border-bottom: 1px solid var(--cw-line); cursor: pointer; text-align: left; font-family: inherit; }
.conv:hover, .conv.active { background: #FFF8EC; }
.conv .av { width: 42px; height: 42px; border-radius: 50%; background: var(--cw-ink); color: var(--cw-sun); display: grid; place-items: center; font-weight: 800; overflow: hidden; flex-shrink: 0; }
.conv .av img { width: 100%; height: 100%; object-fit: cover; }
.conv .cv { flex: 1; min-width: 0; } .conv .cv b { display: block; font-size: 14px; color: #222; }
.conv .cv small { display: block; color: #7A7F8C; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .cwhen { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; } .conv .cwhen small { font-size: 11px; color: #9A9EAA; }
.conv .unread { background: #E5484D; color: #fff; font-style: normal; font-size: 11px; font-weight: 800; border-radius: 99px; padding: 1px 7px; }
.inbox-none { text-align: center; padding: 40px 20px; color: #7A7F8C; } .inbox-none i { font-size: 36px; color: #CFCBC2; margin-bottom: 10px; display: block; }
[data-conv-list], [data-conv-thread] { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
[data-conv-list][hidden], [data-conv-thread][hidden] { display: none; }
/* inbox pages */
.inbox { display: grid; grid-template-columns: 320px 1fr; height: 640px; overflow: hidden; padding: 0 !important; }
.inbox-list { border-right: 1px solid var(--cw-line); display: flex; flex-direction: column; min-height: 0; }
.inbox-head { padding: 14px 16px; font-weight: 800; border-bottom: 1px solid var(--cw-line); font-family: 'Sora', sans-serif; }
.inbox-items { overflow-y: auto; flex: 1; }
.inbox-thread { display: flex; flex-direction: column; min-height: 0; background: var(--cw-bg); }
.inbox-empty { margin: auto; text-align: center; color: #7A7F8C; padding: 20px; } .inbox-empty i { font-size: 44px; color: #CFCBC2; margin-bottom: 10px; display: block; }
.inbox .thread-head [data-back] { display: none; }
@media (max-width: 760px) {
  .inbox { grid-template-columns: 1fr; height: calc(100vh - 220px); }
  .inbox .inbox-thread { display: none; } .inbox.show-thread .inbox-list { display: none; } .inbox.show-thread .inbox-thread { display: flex; }
  .inbox .thread-head [data-back] { display: inline-block; }
  .cw { right: 14px; bottom: 82px; } .cw-label { display: none; }
  .cw-panel { position: fixed; inset: 0; width: auto; height: auto; bottom: 0; border-radius: 0; }
  body.cw-open { overflow: hidden; }
  .cw.open .cw-fab { display: none; }
}
