.customer-chat-widget { position: fixed; right: 18px; bottom: 82px; z-index: 170; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
.customer-chat-widget__toggle { position: relative; min-width: 98px; min-height: 44px; border: 0; border-radius: 24px; background: #c81048; color: #fff; font: 800 14px/1 sans-serif; box-shadow: 0 6px 18px rgba(80, 0, 24, .28); cursor: grab; touch-action: none; }
.customer-chat-widget__unread { position: absolute; top: -8px; right: -8px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border: 2px solid #fff; border-radius: 999px; background: #e60012; color: #fff; font: 800 11px/1 sans-serif; box-shadow: 0 2px 5px rgba(60, 0, 0, .3); pointer-events: none; }
.customer-chat-widget__unread[hidden] { display: none; }
.customer-chat-widget__panel { position: absolute; right: 0; bottom: 54px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; width: min(380px, calc(100vw - 24px)); height: min(590px, calc(100dvh - 130px)); border: 1px solid #e6b8c7; border-radius: 18px; background: #fff; box-shadow: 0 18px 48px rgba(42, 16, 26, .3); overflow: hidden; }
.customer-chat-widget__panel:has(> .customer-chat-widget__contact) { grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
.customer-chat-widget__contact { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 9px; max-height: 84px; overflow-y: auto; padding: 5px 10px; border-bottom: 1px solid #ead9df; font-size: 12px; color: #6e2340; }
.customer-chat-widget__contact strong { width: 100%; }
.customer-chat-widget__contact span { overflow-wrap: anywhere; }
.customer-chat-widget__contact img { width: 42px; height: 42px; object-fit: contain; border: 1px solid #ead9df; border-radius: 5px; }
.customer-chat-widget__panel[hidden] { display: none; }
.customer-chat-widget__panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: #df3f72; color: #fff; }
.customer-chat-widget__panel header div { display: grid; gap: 3px; }
.customer-chat-widget__panel header small { color: #fff0f5; }
.customer-chat-widget__panel header button { width: 40px; height: 40px; border: 0; background: transparent; color: #fff; font-size: 30px; cursor: pointer; }
.customer-chat-widget__messages { display: grid; align-content: start; gap: 10px; min-height: 0; padding: 14px; overflow-y: auto; background: #f8f5f6; overscroll-behavior: contain; }
.customer-chat-widget__empty { align-self: center; justify-self: center; margin: 30px 0; padding: 14px 18px; border-radius: 14px; background: #fff; color: #76545f; }
.customer-chat-widget__message { display: grid; gap: 5px; max-width: 86%; padding: 10px 12px; border-radius: 14px; background: #fff; color: #192033; overflow-wrap: anywhere; }
.customer-chat-widget__message--user { justify-self: end; background: #f7d9e3; }
.customer-chat-widget__message--agent { justify-self: start; }
.customer-chat-widget__message strong { color: #9d274c; font-size: 12px; }
.customer-chat-widget__message p { margin: 0; line-height: 1.5; }
.customer-chat-widget__message img { display: block; max-width: 100%; max-height: 240px; border-radius: 10px; object-fit: contain; }
.customer-chat-widget__message time { color: #8d7b81; font-size: 11px; }
.customer-chat-widget__new-message { position: sticky; bottom: 4px; justify-self: center; margin-top: -38px; z-index: 2; border: 0; border-radius: 16px; background: #8f2949; color: #fff; padding: 7px 14px; }
.customer-chat-widget__panel form { position: sticky; bottom: 0; display: grid; gap: 8px; padding: 10px; border-top: 1px solid #ead9df; background: #fff; }
.customer-chat-widget__panel textarea { width: 100%; min-height: 74px; max-height: 140px; resize: vertical; border: 1px solid #d9bdc7; border-radius: 12px; padding: 10px; font: inherit; }
.customer-chat-widget__panel form p { min-height: 18px; margin: 0; color: #9d274c; font-size: 12px; }
.customer-chat-widget__actions { display: flex; justify-content: flex-end; gap: 8px; }
.customer-chat-widget__actions button, .customer-chat-widget__image-button { min-height: 42px; border: 1px solid #bd5475; border-radius: 12px; padding: 10px 15px; font: inherit; font-weight: 800; cursor: pointer; }
.customer-chat-widget__actions button { background: #c93666; color: #fff; }
.customer-chat-widget__image-button { display: inline-flex; align-items: center; background: #fff; color: #8f2949; }
.customer-chat-widget__image-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.service-open-chat { min-height: 44px; border: 0; border-radius: 12px; background: #c93666; color: #fff; padding: 10px 20px; font-weight: 800; }
@media (max-width: 640px) {
  .customer-chat-widget { right: 10px; bottom: calc(74px + env(safe-area-inset-bottom)); }
  .customer-chat-widget__panel { position: fixed; inset: 8px 8px calc(70px + env(safe-area-inset-bottom)); width: auto; height: auto; max-height: calc(100dvh - 86px - env(safe-area-inset-bottom)); border-radius: 18px; }
  .customer-chat-widget__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .customer-chat-widget__actions button, .customer-chat-widget__image-button { justify-content: center; }
  .customer-chat-widget__panel header button { flex: 0 0 44px; width: 44px; height: 44px; }
  .customer-chat-widget__actions button, .customer-chat-widget__image-button,
  .customer-chat-widget__new-message { min-width: 44px; min-height: 44px; }
}
