.mall-customer-service-root {
  --mall-service-right: max(14px, calc((100vw - 430px) / 2 + 14px));
  position: fixed;
  right: var(--mall-service-right);
  bottom: calc(94px + env(safe-area-inset-bottom));
  width: 0;
  height: 0;
  z-index: 2200;
  pointer-events: none;
  font-family: Inter, "Noto Sans Khmer", "Noto Sans SC", system-ui, sans-serif;
}

.mall-customer-service-root button,
.mall-customer-service-root textarea {
  font: inherit;
}

.mall-customer-service-root button {
  cursor: pointer;
}

.mall-customer-service-fab,
.mall-customer-service-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  pointer-events: auto;
}

.mall-customer-service-fab {
  width: 46px;
  height: 46px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 50%;
  padding: 0;
  background: rgba(25, 28, 32, 0.58);
  backdrop-filter: blur(15px) saturate(1.2);
  -webkit-backdrop-filter: blur(15px) saturate(1.2);
  color: #fff;
  box-shadow: 0 10px 26px rgba(10, 12, 16, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font-size: 12px;
  font-weight: 800;
  touch-action: none;
  user-select: none;
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
}

.mall-customer-service-fab:hover {
  border-color: rgba(255, 255, 255, 0.68);
  background: rgba(25, 28, 32, 0.72);
}

.mall-customer-service-root.is-open .mall-customer-service-fab {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

.mall-customer-service-root.is-dragging,
.mall-customer-service-root.is-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
}

html.mall-service-dragging,
body.mall-service-dragging {
  overscroll-behavior: none;
  overflow: hidden !important;
}

.mall-customer-service-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 16px;
  font-weight: 900;
}

.mall-customer-service-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.mall-customer-service-unread {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  padding: 0 4px;
  background: #dc3947;
  color: #fff;
  font-size: 9px;
  line-height: 1;
}

.mall-customer-service-unread[hidden] {
  display: none;
}

.mall-customer-service-toast {
  position: absolute;
  right: 0;
  bottom: 52px;
  width: min(260px, calc(100vw - 24px));
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 9px;
  padding: 9px 11px;
  background: rgba(24, 39, 35, 0.82);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  box-shadow: 0 12px 32px rgba(8, 22, 18, 0.24);
  color: #fff;
  font-size: 11px;
  line-height: 1.45;
  text-align: left;
  pointer-events: auto;
}

.mall-customer-service-toast[hidden],
.mall-customer-service-root.is-open .mall-customer-service-toast {
  display: none;
}

.mall-customer-service-panel {
  width: min(330px, calc(100vw - 20px));
  height: min(430px, calc(100dvh - 132px));
  min-height: 310px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  border: 1px solid rgba(222, 235, 229, 0.82);
  border-radius: 12px;
  background: rgba(245, 249, 247, 0.86);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  color: #20302b;
  box-shadow: 0 18px 46px rgba(16, 35, 30, 0.24);
}

.mall-customer-service-panel[hidden] {
  display: none;
}

.mall-customer-service-header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(7, 92, 76, 0.86);
  cursor: grab;
  touch-action: none;
  user-select: none;
  color: #fff;
}

.mall-customer-service-heading {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.mall-customer-service-heading strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mall-customer-service-heading small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.mall-customer-service-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 25px;
  line-height: 1;
}

.mall-customer-service-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.mall-customer-service-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 11px 10px;
  overscroll-behavior: contain;
}

.mall-customer-service-empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  color: #7b8b86;
  font-size: 12px;
  text-align: center;
}

.mall-customer-service-message {
  max-width: 84%;
  display: grid;
  gap: 4px;
  margin: 0 0 10px;
}

.mall-customer-service-message.is-customer {
  margin-left: auto;
  justify-items: end;
}

.mall-customer-service-meta {
  color: #899792;
  font-size: 10px;
}

.mall-customer-service-bubble {
  margin: 0;
  border-radius: 11px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 2px 7px rgba(25, 64, 53, 0.06);
  color: #30423c;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mall-customer-service-message.is-customer .mall-customer-service-bubble {
  background: rgba(204, 238, 228, 0.82);
  color: #164e45;
}

.mall-customer-service-bubble.is-voice {
  width: 230px;
  padding: 5px 7px;
}

.mall-customer-service-bubble audio {
  width: 100%;
  height: 32px;
  display: block;
}

.mall-customer-service-status-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #e2eae7;
  padding: 6px 11px;
  background: rgba(255, 255, 255, 0.74);
}

.mall-customer-service-status {
  flex: 1;
  margin: 0;
  color: #a33f47;
  font-size: 11px;
  line-height: 1.4;
}

.mall-customer-service-status[hidden],
.mall-customer-service-retry[hidden] {
  display: none;
}

.mall-customer-service-retry {
  min-height: 30px;
  border: 1px solid #cfe0d9;
  border-radius: 7px;
  padding: 0 8px;
  background: #f2f8f5;
  color: #075c4c;
  font-size: 11px;
  font-weight: 800;
}

.mall-customer-service-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  border-top: 1px solid #e2eae7;
  padding: 8px 9px;
  background: rgba(255, 255, 255, 0.78);
}

.mall-customer-service-composer textarea {
  width: 100%;
  min-height: 38px;
  resize: none;
  box-sizing: border-box;
  border: 1px solid #d5e1dc;
  border-radius: 9px;
  padding: 8px 9px;
  background: rgba(249, 251, 250, 0.78);
  color: #243532;
  font-size: 13px;
  line-height: 1.4;
}

.mall-customer-service-composer textarea:focus {
  border-color: #0f6d59;
  outline: 2px solid rgba(15, 109, 89, 0.13);
}

.mall-customer-service-send {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  padding: 0 11px;
  background: #0f6d59;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.mall-customer-service-send:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 430px) {
  .mall-customer-service-root {
    right: 12px;
    bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .mall-customer-service-panel {
    width: min(320px, calc(100vw - 18px));
    height: min(420px, calc(100dvh - 112px));
  }
}

html .mall-home {
  grid-template-columns: 100px minmax(0, 1fr);
}

html .mall-home .mall-category-grid > a,
html .mall-category-rail a {
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

html .mall-category-page {
  grid-template-columns: 100px minmax(0, 1fr);
}

.finance-app:not(:has(.customer-card.active)) {
  padding-bottom: 20px;
}

.finance-app:not(:has(.customer-card.active)) .bottom-action {
  position: static;
  width: auto;
  margin: 0 12px 12px;
  transform: none;
  padding: 8px 0 0;
  border-top: 1px solid #e5ebe8;
  background: transparent;
}

@media (max-width: 390px) {
  html .mall-home,
  html .mall-category-page {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  html .mall-home .mall-category-grid > a,
  html .mall-category-rail a {
    height: 54px;
    min-height: 54px;
    max-height: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mall-customer-service-root * {
    scroll-behavior: auto !important;
  }
}
