/* ═══════════════════════════════════════════════════
 *  YNPay(28.kais88.com) · 在线客服挂件样式（独立模块）
 *  顾客模式：右下悬浮圆钮（官网 index.html）
 *  商户模式：右上角入口（控制台 index.php）
 * ═══════════════════════════════════════════════════ */
.pk-btn{
  position:fixed;z-index:1500;display:inline-flex;align-items:center;gap:8px;
  border:0;cursor:pointer;font-family:inherit;
  background:linear-gradient(135deg,#3a78ee,#5b96f4);color:#fff;
  box-shadow:0 6px 20px rgba(58,120,238,.35);
  transition:transform .15s ease,filter .15s ease;
}
.pk-btn:hover{filter:brightness(1.06);transform:translateY(-1px)}
.pk-btn .pk-ico{width:20px;height:20px;flex:none}
.pk-dot{width:9px;height:9px;border-radius:50%;flex:none;position:relative}
.pk-dot.off{background:#f0a13a}
.pk-dot.on{background:#3ecf8e}
.pk-dot.on::after{content:"";position:absolute;inset:-3px;border-radius:50%;border:1px solid rgba(62,207,142,.6);animation:pk-pulse 1.6s ease-out infinite}
@keyframes pk-pulse{from{transform:scale(.6);opacity:1}to{transform:scale(1.5);opacity:0}}

/* 顾客模式 */
.pk-customer .pk-btn{right:18px;bottom:24px;width:56px;height:56px;border-radius:50%;justify-content:center}
.pk-customer .pk-btn .pk-btn-txt{display:none}
.pk-customer .pk-panel{right:18px;bottom:92px}

/* 商户模式：右上角 */
.pk-merchant .pk-btn{right:14px;top:10px;padding:8px 14px;border-radius:22px;font-size:13px}
.pk-merchant .pk-panel{right:14px;top:52px}

/* 面板 */
.pk-panel{
  position:fixed;z-index:1501;width:360px;max-width:calc(100vw - 24px);height:520px;max-height:calc(100vh - 110px);
  background:#fff;border-radius:16px;box-shadow:0 12px 48px rgba(16,35,74,.22);
  display:none;flex-direction:column;overflow:hidden;
  border:1px solid #ececec;color:#1a1a2e;font-size:14px;line-height:1.5;
}
.pk-panel.open{display:flex;animation:pk-in .18s ease-out}
@keyframes pk-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.pk-head{
  display:flex;align-items:center;gap:8px;padding:12px 14px;flex:none;
  background:linear-gradient(135deg,#3a78ee 0%,#5b96f4 100%);color:#fff;
}
.pk-head b{font-size:15px}
.pk-head .pk-status{display:inline-flex;align-items:center;gap:5px;font-size:12px;opacity:.95}
.pk-head .pk-close{margin-left:auto;border:0;background:rgba(255,255,255,.16);color:#fff;width:26px;height:26px;border-radius:50%;cursor:pointer;font-size:15px;line-height:1}
.pk-head .pk-close:hover{background:rgba(255,255,255,.3)}

.pk-tabs{display:flex;flex:none;border-bottom:1px solid #ececec;background:#f6f7fa}
.pk-tab{flex:1;border:0;background:none;cursor:pointer;padding:10px 0;font-size:13px;color:#666;font-family:inherit;border-bottom:2px solid transparent}
.pk-tab.active{color:#3a78ee;border-bottom-color:#3a78ee;font-weight:600}

.pk-chat{display:none;flex:1;flex-direction:column;min-height:0}
.pk-msgs{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:8px;background:#fbfcfe}
.pk-msg{display:flex;flex-direction:column;max-width:82%}
.pk-msg.me{align-self:flex-end;align-items:flex-end}
.pk-msg .pk-sender{font-size:11px;color:#98a2b3;margin:0 2px 2px}
.pk-msg.admin .pk-sender{color:#3a78ee}
.pk-bubble{padding:8px 12px;border-radius:12px;font-size:13.5px;word-break:break-word;white-space:pre-wrap}
.pk-msg.user .pk-bubble{background:#eef3ff;color:#1a1a2e;border-top-left-radius:4px}
.pk-msg.me .pk-bubble{background:linear-gradient(135deg,#3a78ee,#5b96f4);color:#fff;border-top-right-radius:4px}
.pk-msg.sys{align-self:center;max-width:95%}
.pk-msg.sys .pk-bubble{background:#f1f3f7;color:#7a8699;font-size:12px;border-radius:8px}
.pk-time{font-size:10.5px;color:#b6bfcc;margin-top:2px}

.pk-chips{display:flex;gap:6px;flex-wrap:wrap;padding:8px 12px;flex:none;border-top:1px solid #f0f2f6;background:#fff}
.pk-chip{border:1px solid #d9e2f2;background:#f6f9ff;color:#3a78ee;border-radius:14px;padding:4px 10px;font-size:12px;cursor:pointer;font-family:inherit}
.pk-chip:hover{background:#eaf1ff}

.pk-inputrow{display:flex;gap:8px;padding:10px 12px;flex:none;border-top:1px solid #f0f2f6;background:#fff}
.pk-inputrow input{flex:1;border:1px solid #dde3ec;border-radius:10px;padding:9px 12px;font-size:13.5px;font-family:inherit;outline:none;min-width:0}
.pk-inputrow input:focus{border-color:#3a78ee}
.pk-inputrow button{border:0;background:linear-gradient(135deg,#3a78ee,#5b96f4);color:#fff;border-radius:10px;padding:0 16px;font-size:13.5px;font-weight:600;cursor:pointer;font-family:inherit}
.pk-inputrow button:disabled{opacity:.55;cursor:not-allowed}

.pk-leave{display:none;flex:1;flex-direction:column;gap:8px;padding:14px;overflow-y:auto}
.pk-leave.show{display:flex}
.pk-leave-tip{background:#fff8ec;border:1px solid #f5e3c0;color:#8a6d3b;border-radius:10px;padding:9px 11px;font-size:12.5px}
.pk-leave label{font-size:12.5px;color:#5b6472;margin-top:4px}
.pk-leave input,.pk-leave textarea{border:1px solid #dde3ec;border-radius:10px;padding:9px 12px;font-size:13.5px;font-family:inherit;outline:none;resize:vertical}
.pk-leave input:focus,.pk-leave textarea:focus{border-color:#3a78ee}
.pk-leave-submit{margin-top:6px}

.pk-badge{position:absolute;top:-4px;right:-4px;min-width:18px;height:18px;border-radius:9px;background:#e63946;color:#fff;
  font-size:11px;line-height:18px;text-align:center;padding:0 4px;display:none;font-weight:600}
.pk-customer .pk-btn .pk-badge{top:0;right:0}
.pk-merchant .pk-btn .pk-badge{top:-5px;right:-5px}

/* 移动端 */
@media (max-width:680px){
  .pk-customer .pk-panel,.pk-merchant .pk-panel{
    left:8px;right:8px;top:auto;bottom:8px;width:auto;height:auto;
    max-height:calc(100vh - 90px);height:70vh;
  }
  .pk-customer .pk-btn{right:14px;bottom:18px}
  .pk-merchant .pk-btn{right:8px;top:8px}
}
