/* 在线咨询（邮箱代答）· 浮动按钮与聊天面板 */

/* hidden 属性兜底：防止组件内 display:flex 等样式覆盖 UA 的 display:none */
.chat-float [hidden] { display: none !important; }

.chat-float { position: fixed; right: 16px; top: calc(34vh + 70px); z-index: 65; }

.chat-btn {
  width: 58px; height: 58px; border-radius: 16px; border: 0; cursor: pointer; padding: 0;
  background: linear-gradient(135deg, #1e5eff, #0891b2); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  box-shadow: 0 10px 26px rgba(30, 94, 255, .3);
  position: relative;
}
.chat-btn svg { width: 22px; height: 22px; }
.chat-btn span { font-size: 11px; line-height: 1.25; font-weight: 600; font-family: inherit; }
.chat-btn:active { transform: scale(.97); }
.chat-dot {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px;
  border-radius: 99px; background: #f43f5e; color: #fff; font-size: 11px; font-style: normal;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  box-shadow: 0 2px 6px rgba(244, 63, 94, .45);
}

.chat-panel {
  position: absolute; right: 66px; bottom: 0; width: 320px; height: 440px;
  background: #fff; border: 1px solid #e6ebf4; border-radius: 18px;
  box-shadow: 0 22px 60px rgba(23, 35, 61, .22);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateX(10px); pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.chat-float.open .chat-panel { opacity: 1; transform: none; pointer-events: auto; }

.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  background: linear-gradient(120deg, #16336e, #0d4f7e); color: #fff; flex-shrink: 0;
}
.chat-head b { font-size: 15px; display: block; }
.chat-head span { font-size: 11px; opacity: .75; display: block; margin-top: 1px; }
.chat-x {
  margin-left: auto; width: 28px; height: 28px; border-radius: 8px; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 18px; line-height: 1;
}
.chat-x:hover { background: rgba(255, 255, 255, .26); }

.chat-body { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #f5f8fd; }

/* 未登记 */
.chat-start { padding: 22px 18px; }
.chat-start p { font-size: 13.5px; color: #4a5a75; line-height: 1.7; margin-bottom: 12px; }
.chat-in {
  width: 100%; height: 44px; border: 1px solid #e6ebf4; border-radius: 11px;
  padding: 0 12px; font-size: 15px; margin-bottom: 9px; background: #fff;
  font-family: inherit; color: #17233d;
}
.chat-in:focus { outline: none; border-color: #1e5eff; box-shadow: 0 0 0 3px rgba(30, 94, 255, .1); }
.chat-go {
  width: 100%; height: 44px; border: 0; border-radius: 11px; cursor: pointer;
  background: linear-gradient(120deg, #1e5eff, #0891b2); color: #fff;
  font-size: 15px; font-weight: 600; font-family: inherit;
}
.chat-go:disabled { opacity: .6; }
.chat-err { font-size: 12.5px; color: #e11d48; margin-top: 8px; min-height: 17px; text-align: center; }

/* 消息区 */
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-m { max-width: 82%; }
.chat-m .b {
  padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.chat-m .t { font-size: 10.5px; color: #8a97ad; margin-top: 3px; }
.chat-me { align-self: flex-end; }
.chat-me .b { background: linear-gradient(120deg, #1e5eff, #0891b2); color: #fff; border-bottom-right-radius: 4px; }
.chat-me .t { text-align: right; }
.chat-sv { align-self: flex-start; }
.chat-sv .b { background: #fff; border: 1px solid #e6ebf4; color: #17233d; border-bottom-left-radius: 4px; }
.chat-hint { align-self: center; font-size: 11px; color: #8a97ad; background: #eef2f9; border-radius: 99px; padding: 4px 12px; }
.chat-sys { align-self: center; max-width: 88%; font-size: 12px; line-height: 1.7; color: #7a5b13; background: #fff7e0; border: 1px solid #f2e3ad; border-radius: 10px; padding: 8px 12px; text-align: center; }

/* 输入区 */
.chat-input {
  display: flex; gap: 8px; padding: 10px; background: #fff; border-top: 1px solid #e6ebf4; flex-shrink: 0;
}
.chat-input textarea {
  flex: 1; border: 1px solid #e6ebf4; border-radius: 11px; padding: 9px 11px;
  font-size: 14px; font-family: inherit; resize: none; max-height: 88px; color: #17233d;
}
.chat-input textarea:focus { outline: none; border-color: #1e5eff; }
.chat-input button {
  width: 62px; border: 0; border-radius: 11px; cursor: pointer;
  background: linear-gradient(120deg, #1e5eff, #0891b2); color: #fff;
  font-size: 14px; font-weight: 600; font-family: inherit; flex-shrink: 0;
}
.chat-input button:disabled { opacity: .6; }

/* 移动端：贴右下（主站） */
@media (max-width: 860px) {
  .chat-float { top: auto; bottom: 88px; right: 14px; }
  .chat-panel {
    right: 0; bottom: 66px; width: min(320px, calc(100vw - 24px));
    height: min(440px, 62vh);
  }
}

/* H5 页（m.html，body.m-page）：底栏更高，按钮再抬高 */
body.m-page .chat-float { top: auto; bottom: calc(96px + env(safe-area-inset-bottom)); }
