/* ============================================================
   CN / CHUANNE — Inquiry AI Chat Widget
   黑白灰三色 · 针迹虚线母题 · Space Mono 数据标签
   ============================================================ */
#cn-chat-btn {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9990;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid #0A0A0A;
  background: #0A0A0A;
  color: #fff;
  font-family: "Space Grotesk", "Source Han Sans SC", "PingFang SC", sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 8px 28px rgba(10, 10, 10, .28);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), background .25s, color .25s;
}
#cn-chat-btn:hover { transform: translateY(-3px) scale(1.05); background: #fff; color: #0A0A0A; }
#cn-chat-btn .dot {
  position: absolute; top: 5px; right: 5px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff; border: 2px solid #0A0A0A;
}
#cn-chat-btn.offline .dot { background: #C7C7C7; }

#cn-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 9991;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 130px);
  background: #FFFFFF;
  border: 1.5px solid #0A0A0A;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(10, 10, 10, .22);
  font-family: "Space Grotesk", "Source Han Sans SC", "PingFang SC", sans-serif;
}
#cn-chat-panel.open { display: flex; animation: cnPop .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes cnPop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---- header ---- */
.cn-chat-head {
  background: #0A0A0A;
  color: #fff;
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
}
.cn-chat-head .t { display: flex; flex-direction: column; gap: 3px; }
.cn-chat-head .brand { font-size: 15px; font-weight: 700; letter-spacing: .06em; display: flex; align-items: center; gap: 8px; }
.cn-chat-head .brand .mark {
  width: 24px; height: 24px; border: 1px solid #fff; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0;
}
.cn-chat-head .sub { font-family: "Space Mono", "JetBrains Mono", monospace; font-size: 9px; letter-spacing: .18em; color: #C7C7C7; }
.cn-chat-head .acts { display: flex; gap: 8px; }
.cn-chat-head .acts button {
  background: none; border: 1px solid #636363; color: #fff;
  font-family: "Space Mono", monospace; font-size: 9px; letter-spacing: .12em;
  padding: 5px 10px; cursor: pointer; transition: all .2s;
}
.cn-chat-head .acts button:hover { background: #fff; color: #0A0A0A; border-color: #fff; }
/* 留言询价按钮：做成主按钮，避免被忽略 */
.cn-chat-head .acts button.cn-lead-btn { background: #fff; color: #0A0A0A; border-color: #fff; font-weight: 700; }
.cn-chat-head .acts button.cn-lead-btn:hover { background: transparent; color: #fff; }
.cn-stitch { height: 1px; background-image: linear-gradient(to right, #0A0A0A 45%, transparent 45%); background-size: 7px 1px; flex: none; }

/* ---- messages ---- */
.cn-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  background: #F4F4F4;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cn-chat-body::-webkit-scrollbar { width: 4px; }
.cn-chat-body::-webkit-scrollbar-thumb { background: #C7C7C7; }
.cn-msg { max-width: 86%; font-size: 13px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.cn-msg.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #E2E2E2;
  border-left: 2px solid #0A0A0A;
  padding: 10px 12px;
}
.cn-msg.user {
  align-self: flex-end;
  background: #0A0A0A;
  color: #fff;
  padding: 10px 12px;
}
.cn-msg .who {
  display: block;
  font-family: "Space Mono", monospace; font-size: 8px; letter-spacing: .2em;
  color: #8C8C8C; margin-bottom: 5px;
}
.cn-msg.user .who { color: #C7C7C7; }
.cn-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.cn-typing i { width: 5px; height: 5px; background: #0A0A0A; border-radius: 50%; animation: cnBlink 1.1s infinite; }
.cn-typing i:nth-child(2) { animation-delay: .22s; }
.cn-typing i:nth-child(3) { animation-delay: .44s; }
@keyframes cnBlink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* ---- quick chips ---- */
.cn-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px; background: #F4F4F4; flex: none; border-top: 1px solid #E2E2E2; }
.cn-chip {
  border: 1px solid #C7C7C7; background: #fff; color: #0A0A0A;
  font-family: inherit; font-size: 11px; padding: 5px 11px; cursor: pointer;
  transition: all .18s; letter-spacing: .02em;
}
.cn-chip:hover { background: #0A0A0A; color: #fff; border-color: #0A0A0A; }

/* ---- input ---- */
.cn-chat-input { display: flex; gap: 8px; padding: 12px 14px; background: #fff; border-top: 1px solid #E2E2E2; flex: none; }
.cn-chat-input input {
  flex: 1; border: 1px solid #C7C7C7; background: #F4F4F4;
  font-family: inherit; font-size: 13px; padding: 10px 12px; outline: none;
  transition: border-color .2s;
}
.cn-chat-input input:focus { border-color: #0A0A0A; background: #fff; }
.cn-chat-input button {
  border: none; background: #0A0A0A; color: #fff; font-family: inherit;
  font-size: 12px; font-weight: 700; letter-spacing: .08em; padding: 0 16px;
  cursor: pointer; transition: all .2s;
}
.cn-chat-input button:hover { background: #fff; color: #0A0A0A; outline: 1.5px solid #0A0A0A; }
.cn-chat-input button:disabled { opacity: .4; cursor: default; }

/* ---- lead form ---- */
.cn-lead {
  padding: 14px; background: #fff; border-top: 1px dashed #C7C7C7;
  display: none; flex-direction: column; gap: 8px; flex: none; max-height: 300px; overflow-y: auto;
}
.cn-lead.open { display: flex; }
.cn-lead h5 {
  margin: 0; font-size: 12px; letter-spacing: .1em;
  font-family: "Space Mono", monospace; color: #0A0A0A;
}
.cn-lead input, .cn-lead select, .cn-lead textarea {
  border: 1px solid #C7C7C7; background: #F4F4F4; font-family: inherit;
  font-size: 12px; padding: 8px 10px; outline: none; width: 100%; box-sizing: border-box;
}
.cn-lead input:focus, .cn-lead select:focus, .cn-lead textarea:focus { border-color: #0A0A0A; background: #fff; }
.cn-lead textarea { resize: vertical; min-height: 46px; }
.cn-lead .row { display: flex; gap: 8px; }
.cn-lead .row > * { flex: 1; }
.cn-lead button {
  border: none; background: #0A0A0A; color: #fff; font-family: inherit;
  font-size: 12px; font-weight: 700; letter-spacing: .1em; padding: 10px; cursor: pointer;
}
.cn-lead button:hover { background: #fff; color: #0A0A0A; outline: 1.5px solid #0A0A0A; }
.cn-lead .ok-note { font-size: 11px; color: #636363; line-height: 1.6; }
.cn-lead .ok-note b { color: #0A0A0A; }

/* ---- mobile ---- */
@media (max-width: 480px) {
  #cn-chat-panel {
    right: 8px; left: 8px; bottom: 84px;
    width: auto; max-width: none;
    height: calc(100vh - 100px);
  }
  #cn-chat-btn { right: 14px; bottom: 14px; }
}
