/* ===== 前臺在線客服小窗 ===== */
.cs-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1055;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: #0d6efd;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(13, 110, 253, 0.35);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.cs-launcher:hover {
  background: #0b5ed7;
  transform: translateY(-2px);
}

.cs-launcher-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e4393c;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  display: none;
  box-shadow: 0 0 0 2px #fff;
}

.cs-launcher-badge.is-show {
  display: block;
}

/* ---------- 面板 ---------- */
.cs-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 1055;
  width: 366px;
  height: 520px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border: 1px solid #e3e6ea;
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(15, 25, 40, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.cs-panel.is-open {
  display: flex;
}

.cs-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(120deg, #1f3a5f 0%, #2f6fb5 60%, #4aa3df 100%);
  color: #fff;
}

.cs-head-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}

.cs-head-sub {
  font-size: 0.72rem;
  opacity: 0.85;
  margin-top: 2px;
}

.cs-head-close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0.85;
  padding: 2px 6px;
}

.cs-head-close:hover {
  opacity: 1;
}

/* ---------- 消息區 ---------- */
.cs-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  background: #f6f7f9;
}

.cs-welcome {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 12px 14px;
  color: #495057;
  font-size: 0.83rem;
  line-height: 1.6;
}

.cs-welcome-title {
  font-weight: 600;
  color: #212529;
  margin-bottom: 4px;
}

.cs-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.cs-quick button {
  border: 1px solid #cfd8e3;
  background: #fff;
  color: #2f6fb5;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.76rem;
}

.cs-quick button:hover {
  background: #eef4fd;
}

.cs-msg {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.cs-msg-visitor {
  align-items: flex-end;
}

.cs-msg-service {
  align-items: flex-start;
}

.cs-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.86rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.cs-msg-visitor .cs-bubble {
  background: #0d6efd;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.cs-msg-service .cs-bubble {
  background: #fff;
  color: #212529;
  border: 1px solid #e3e6ea;
  border-bottom-left-radius: 4px;
}

.cs-meta {
  margin-top: 3px;
  font-size: 0.7rem;
  color: #98a2b3;
}

.cs-msg-failed .cs-bubble {
  opacity: 0.6;
}

.cs-msg-failed .cs-meta {
  color: #e4393c;
}

.cs-notice {
  margin: 0 0 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff8e6;
  border: 1px solid #ffe3a3;
  color: #8a6100;
  font-size: 0.76rem;
  text-align: center;
}

/* ---------- 輸入區 ---------- */
.cs-foot {
  flex: 0 0 auto;
  border-top: 1px solid #eceff3;
  background: #fff;
  padding: 10px;
}

.cs-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.cs-input {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.86rem;
  line-height: 1.5;
  max-height: 96px;
  min-height: 38px;
  outline: none;
}

.cs-input:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}

.cs-send {
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  background: #0d6efd;
  color: #fff;
  font-size: 0.86rem;
  padding: 8px 14px;
  height: 38px;
}

.cs-send:disabled {
  opacity: 0.6;
}

.cs-foot-tip {
  margin-top: 6px;
  font-size: 0.7rem;
  color: #98a2b3;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.cs-foot-tip .cs-err {
  color: #e4393c;
}

.cs-foot-tip .cs-end {
  color: #98a2b3;
  text-decoration: none;
  margin-right: 8px;
}

.cs-foot-tip .cs-end:hover {
  color: #e4393c;
  text-decoration: underline;
}

/* 窄屏（手機瀏覽器/微信內置瀏覽器）：小窗鋪滿寬度，別擠成一條縫 */
@media (max-width: 576px) {
  .cs-launcher {
    right: 16px;
    bottom: 16px;
  }

  .cs-panel {
    right: 10px;
    left: 10px;
    bottom: 84px;
    width: auto;
    height: 68vh;
    max-height: none;
  }
}
