.kefu-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e23b3b;
  color: #fff;
  border: 2px solid #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
}

.kefu-tip {
  position: fixed;
  right: 78px;
  bottom: 36px;
  z-index: 220;
  max-width: 180px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff;
  color: #0d3b2c;
  border: 1px solid #d8e8df;
  font-size: .82rem;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}

.kefu-fab {
  position: fixed;
  right: 16px;
  bottom: 24px;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #007a4d;
  color: #fff;
  font-size: .82rem;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(0, 90, 56, .28);
}

@media (max-width: 640px) {
  .kefu-fab {
    bottom: calc(72px + env(safe-area-inset-bottom, 0));
  }
  body:has(.mobile-cta-bar) .kefu-fab {
    bottom: calc(126px + env(safe-area-inset-bottom, 0));
  }
  .kefu-tip {
    bottom: calc(84px + env(safe-area-inset-bottom, 0));
  }
  body:has(.mobile-cta-bar) .kefu-tip {
    bottom: calc(138px + env(safe-area-inset-bottom, 0));
  }
}

.kefu-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 14px 24px;
}

.kefu-card {
  background: #fff;
  border: 1px solid #d8e8df;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 180px);
}

.kefu-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid #e6eeea;
}

.kefu-head strong { font-size: 1.05rem; }
.kefu-head span { color: #007a4d; font-size: .82rem; }

.kefu-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f6f8f7;
  min-height: 280px;
  max-height: calc(100vh - 280px);
}

.kefu-empty { color: #8a9891; text-align: center; margin-top: 40px; font-size: .9rem; }

.kefu-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 14px;
}
.kefu-row.is-user { align-items: flex-end; }

.kefu-bubble {
  max-width: 78%;
  background: #fff;
  border: 1px solid #e4ece8;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: .95rem;
  line-height: 1.5;
  word-break: break-word;
}
.kefu-row.is-user .kefu-bubble {
  background: #e8f5ef;
  border-color: #c5e6d4;
}
.kefu-bubble p { margin: 0; white-space: pre-wrap; }
.kefu-bubble img {
  display: block;
  max-width: 180px;
  border-radius: 8px;
  margin-top: 6px;
}
.kefu-row time { color: #9aa8a1; font-size: .72rem; margin-top: 4px; }

.kefu-form {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-top: 1px solid #e6eeea;
  background: #fff;
}
.kefu-pic {
  flex-shrink: 0;
  width: 52px;
  height: 40px;
  border: 1px solid #d0ddd6;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c0392b;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
}
.kefu-pic input { display: none; }
.kefu-form input[type="text"] {
  flex: 1;
  height: 40px;
  border: 1px solid #d0ddd6;
  border-radius: 20px;
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
}
.kefu-send {
  flex-shrink: 0;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 20px;
  background: #e23b3b;
  color: #fff;
  font-weight: 800;
  font-size: .95rem;
  cursor: pointer;
  font-family: inherit;
}
.kefu-file, .kefu-err {
  margin: 0;
  padding: 0 14px 10px;
  font-size: .8rem;
}
.kefu-file { color: #5a6b62; }
.kefu-err { color: #c0392b; }

@media (max-width: 640px) {
  .kefu-page { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0)); }
  .kefu-card { min-height: calc(100vh - 150px); }
  .kefu-log { max-height: calc(100vh - 250px); }
  .kefu-head { flex-direction: column; gap: 2px; }
}
