/* LeadDesk 前台咨询浮窗 · v2.6.1
   全部类名以 ld- 前缀隔离，不依赖主题样式、不加载外部资源。
   面板宽高由 --ld-w / --ld-h 控制，后台「AI 即用配置 → 浮窗尺寸」可下发。
   v2.6.1：留资表单改为覆盖式浮层（含 [hidden] 强制隐藏），避免遮挡会话与无法收起。 */
:root{--ld-primary:#1f5eff;--ld-primary-dark:#1748cc;--ld-line:#e4e8ef;--ld-text:#1b2430;--ld-muted:#6b7688;--ld-bg:#fff;--ld-pane:#f6f8fb;--ld-bot:#eef2ff;--ld-me:#1f5eff;--ld-shadow:0 16px 48px rgba(20,35,70,.2)}
.ld-chat-launch{position:fixed;right:24px;bottom:24px;z-index:2147483000;width:60px;height:60px;border:0;border-radius:50%;background:var(--ld-primary);color:#fff;box-shadow:var(--ld-shadow);cursor:pointer;display:grid;place-items:center;font:700 23px/1 -apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;transition:transform .18s ease,background .18s ease}
.ld-chat-launch:hover{transform:translateY(-2px);background:var(--ld-primary-dark)}
.ld-chat-launch svg{width:28px;height:28px;fill:currentColor}
.ld-chat-launch .ld-dot{position:absolute;top:2px;right:2px;width:12px;height:12px;background:#16a34a;border:2px solid #fff;border-radius:50%}
.ld-chat-launch .ld-badge{position:absolute;top:-4px;left:-4px;min-width:22px;height:22px;padding:0 5px;border:2px solid #fff;border-radius:999px;background:#e5484d;color:#fff;font-size:12px;font-weight:700;line-height:18px;text-align:center}
.ld-chat-launch .ld-badge[hidden]{display:none}
.ld-chat-panel{--ld-w:440px;--ld-h:640px;position:fixed;right:24px;bottom:96px;z-index:2147483001;width:var(--ld-w);max-width:calc(100vw - 32px);height:var(--ld-h);max-height:calc(100vh - 120px);background:var(--ld-bg);border:1px solid var(--ld-line);border-radius:16px;box-shadow:var(--ld-shadow);display:flex;flex-direction:column;overflow:hidden;font:15px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;color:var(--ld-text);opacity:0;transform:translateY(12px) scale(.98);pointer-events:none;transition:opacity .2s ease,transform .2s ease}
.ld-chat-panel.is-open{opacity:1;transform:none;pointer-events:auto}
.ld-head{display:flex;align-items:center;gap:12px;padding:16px 18px;background:var(--ld-primary);color:#fff;flex:none}
.ld-head-avatar{width:38px;height:38px;border-radius:11px;background:rgba(255,255,255,.2);display:grid;place-items:center;font-weight:800;flex:none}
.ld-head-main{min-width:0;flex:1}
.ld-head-title{font-weight:700;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ld-head-sub{font-size:13px;opacity:.85;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ld-head button{background:transparent;border:0;color:#fff;cursor:pointer;font-size:22px;line-height:1;padding:4px 8px;opacity:.85;min-width:44px;min-height:44px}
.ld-head button:hover{opacity:1}
.ld-quick{padding:12px 16px;display:flex;gap:8px;flex-wrap:wrap;border-bottom:1px solid var(--ld-line);flex:none;background:var(--ld-bg)}
.ld-chip{border:1px solid #cbd9ff;background:#f0f5ff;color:var(--ld-primary-dark);border-radius:999px;padding:7px 14px;font-size:13px;cursor:pointer;font-family:inherit;min-height:44px;display:inline-flex;align-items:center}
.ld-chip:hover{background:#e0ebff}
.ld-log{flex:1;min-height:0;overflow-y:auto;padding:18px 16px;background:var(--ld-pane);scroll-behavior:smooth}
.ld-msg{display:flex;gap:10px;margin-bottom:14px;align-items:flex-end}
.ld-msg.is-me{flex-direction:row-reverse}
.ld-avatar{width:32px;height:32px;border-radius:9px;background:#dbe4ff;color:#24418f;display:grid;place-items:center;font-size:13px;font-weight:700;flex:none}
.ld-msg.is-me .ld-avatar{background:var(--ld-primary);color:#fff}
.ld-bubble{max-width:82%;padding:11px 14px;border-radius:13px 13px 13px 4px;background:var(--ld-bot);white-space:pre-wrap;word-break:break-word;box-shadow:0 1px 2px rgba(20,35,70,.05)}
.ld-msg.is-me .ld-bubble{background:var(--ld-me);color:#fff;border-radius:13px 13px 4px 13px}
.ld-meta{font-size:12px;color:var(--ld-muted);margin-top:5px;display:flex;gap:9px}
.ld-msg.is-me .ld-meta{justify-content:flex-end;color:#8fa4c8}
.ld-system{text-align:center;margin:12px 0}
.ld-system span{display:inline-block;background:#eef1f6;color:var(--ld-muted);border-radius:999px;padding:5px 14px;font-size:12px}
.ld-typing{font-size:13px;color:var(--ld-muted);padding:0 16px 8px;min-height:22px}
.ld-tools{padding:10px 14px;border-top:1px solid var(--ld-line);display:flex;gap:10px;flex:none;background:#fff}
.ld-tools button{flex:1;border:1px solid var(--ld-line);background:#fff;color:var(--ld-text);border-radius:9px;padding:9px 10px;font-size:13px;cursor:pointer;font-family:inherit;min-height:44px}
.ld-tools button:hover{background:#f4f7ff;border-color:#cbd9ff}
.ld-compose{display:flex;gap:10px;padding:12px 14px;border-top:1px solid var(--ld-line);flex:none;background:#fff}
.ld-compose textarea{flex:1;min-width:0;resize:none;border:1px solid var(--ld-line);border-radius:9px;padding:11px 12px;font:15px/1.5 inherit;color:var(--ld-text);height:48px;max-height:110px;font-family:inherit}
.ld-compose textarea:focus{outline:2px solid #cbd9ff;outline-offset:0;border-color:var(--ld-primary)}
.ld-compose button{border:0;border-radius:9px;background:var(--ld-primary);color:#fff;padding:0 20px;font-weight:600;font-size:15px;cursor:pointer;font-family:inherit;flex:none}
.ld-compose button:disabled{opacity:.5;cursor:not-allowed}
.ld-form{position:absolute;left:0;right:0;top:0;bottom:0;z-index:5;padding:16px;background:#fff;overflow-y:auto}
.ld-form[hidden]{display:none!important}
.ld-form-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.ld-form-head h4{margin:0;font-size:16px}
.ld-form-head button{border:0;background:transparent;cursor:pointer;font-size:24px;line-height:1;color:var(--ld-muted);min-width:44px;min-height:44px}
.ld-form-head button:hover{color:var(--ld-text)}
.ld-form .ld-row{display:grid;gap:5px;margin-bottom:10px}
.ld-form label{font-size:13px;color:var(--ld-muted)}
.ld-form input:not([type=checkbox]),.ld-form textarea,.ld-form select{width:100%;box-sizing:border-box;padding:10px 12px;border:1px solid var(--ld-line);border-radius:8px;font:14px/1.5 inherit;color:var(--ld-text);font-family:inherit;min-height:44px;background:#fff}
.ld-form .ld-consent{display:flex;gap:8px;align-items:flex-start;font-size:13px;color:var(--ld-muted);margin:8px 0}
.ld-form .ld-consent input{width:auto;margin-top:3px}
.ld-form-actions{display:flex;gap:10px;margin-top:10px}
.ld-form-actions button{flex:1;border-radius:9px;padding:10px;cursor:pointer;font:14px inherit;font-family:inherit;min-height:44px}
.ld-form-actions .ld-ok{background:var(--ld-primary);color:#fff;border:0}
.ld-form-actions .ld-cancel{background:#fff;border:1px solid var(--ld-line);color:var(--ld-text)}
.ld-form-status{font-size:13px;margin-top:8px;min-height:18px}
.ld-form-status.ok{color:#0a7a45}.ld-form-status.err{color:#b42318}
/* v2.7.6：电话号码独立栏 —— 只收 11 位数字，位数不对即时标红。 */
.ld-form .ld-form-hint{font-size:12px;color:var(--ld-muted);line-height:1.4}
.ld-form input.ld-bad{border-color:#b42318!important;background:#fff7f6!important}
.ld-rate{padding:12px 14px;border-top:1px solid var(--ld-line);text-align:center;font-size:13px;color:var(--ld-muted);background:#fff;flex:none}
.ld-rate[hidden]{display:none!important}
.ld-rate button{border:0;background:none;cursor:pointer;font-size:20px;color:#f5a623;padding:0 3px;min-width:44px;min-height:44px}
/* v2.7.2：头部提示音开关 / 二维码浮层 */
.ld-head .ld-sound{position:relative;background:transparent;border:0;color:#fff;cursor:pointer;min-width:44px;min-height:44px;padding:8px;display:grid;place-items:center;opacity:.85}
.ld-head .ld-sound:hover{opacity:1}
.ld-head .ld-sound svg{width:19px;height:19px;fill:currentColor}
.ld-head .ld-sound.is-off{opacity:.45}
.ld-head .ld-sound.is-off:after{content:"";position:absolute;width:22px;height:2px;background:#fff;transform:rotate(-45deg);border-radius:2px}
.ld-qr{position:absolute;left:0;right:0;top:0;bottom:0;z-index:6;padding:16px;background:#fff;overflow-y:auto;display:flex;flex-direction:column}
.ld-qr[hidden]{display:none!important}
.ld-qr>.ld-form-head,.ld-qr-body,.ld-qr-empty{flex:0 0 auto}
.ld-qr-body{text-align:center;padding:6px 0 12px}
.ld-qr-body img{width:min(240px,78%);max-width:240px;height:auto;box-sizing:border-box;border:1px solid var(--ld-line);border-radius:12px;padding:8px;background:#fff;box-shadow:0 6px 20px rgba(20,35,70,.1)}
.ld-qr-body p{margin:12px 0 0;font-size:14px;color:var(--ld-muted)}
.ld-qr-empty{padding:34px 16px;text-align:center;color:var(--ld-muted);font-size:14px}
.ld-qr-empty p+p{font-size:12px;opacity:.8}
/* v2.7.4：原「复制会话编号」按钮区域 → 后台可编辑的多行自定义文字，占满弹层下半区 */
.ld-qr-custom{flex:1 1 auto;display:flex;align-items:center;justify-content:center;margin:14px 2px 6px;padding:20px 16px;min-height:88px;box-sizing:border-box;border:1px solid var(--ld-line);border-radius:12px;background:#f7faff;color:var(--ld-text);font-size:14px;line-height:1.85;text-align:center;white-space:pre-line;word-break:break-word}
.ld-qr-custom span{white-space:pre-line}
@media (max-width:520px){.ld-chat-panel{right:12px;bottom:86px;width:calc(100vw - 24px);height:min(76vh,640px);border-radius:14px}.ld-chat-launch{right:16px;bottom:16px}.ld-form-actions{flex-direction:column}}
@media (max-height:720px){.ld-chat-panel{height:calc(100vh - 118px)}}
