.cocs-widget{--cocs-primary:#2563eb;--cocs-head-text:#fff;--cocs-width:380px;--cocs-radius:24px;--cocs-launcher:60px;--cocs-z:999999;--cocs-x:24px;--cocs-y:24px;font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;position:fixed;z-index:var(--cocs-z);line-height:1.55;color:#0f172a}
.cocs-widget *{box-sizing:border-box}
.cocs-widget button,.cocs-widget input,.cocs-widget select,.cocs-widget textarea{font:inherit}
.cocs-pos-right-bottom{right:var(--cocs-x);bottom:var(--cocs-y)}.cocs-pos-right-center{right:var(--cocs-x);top:50%;transform:translateY(-50%)}.cocs-pos-right-top{right:var(--cocs-x);top:var(--cocs-y)}.cocs-pos-left-bottom{left:var(--cocs-x);bottom:var(--cocs-y)}.cocs-pos-left-center{left:var(--cocs-x);top:50%;transform:translateY(-50%)}.cocs-pos-left-top{left:var(--cocs-x);top:var(--cocs-y)}
.cocs-embedded{position:relative;inset:auto!important;transform:none!important;width:100%;max-width:var(--cocs-width);margin:24px auto}
.cocs-launcher{display:flex;align-items:center;gap:12px;height:var(--cocs-launcher);padding:8px 12px 8px 8px;border:0;border-radius:999px;background:#fff;color:#0f172a;box-shadow:0 16px 40px rgba(15,23,42,.18),0 2px 8px rgba(15,23,42,.1);cursor:pointer;transition:transform .2s ease,box-shadow .2s ease;position:relative;min-width:var(--cocs-launcher)}
.cocs-launcher:hover{transform:translateY(-2px);box-shadow:0 20px 48px rgba(15,23,42,.22),0 4px 12px rgba(15,23,42,.12)}
.cocs-launcher.is-icon-only{width:var(--cocs-launcher);padding:0;justify-content:center}
.cocs-launcher-icon{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;flex:0 0 44px;border-radius:50%;background:var(--cocs-primary);color:#fff;box-shadow:inset 0 -6px 12px rgba(0,0,0,.12)}
.cocs-launcher-icon svg{width:23px;height:23px;display:block}
.cocs-launcher-label{font-weight:800;font-size:16px;white-space:nowrap;color:#0f172a;padding-right:10px}
.cocs-online-dot{position:absolute;right:5px;top:5px;width:14px;height:14px;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 8px rgba(15,23,42,.18)}
.cocs-online-dot.is-online{background:#22c55e}.cocs-online-dot.is-offline{background:#f59e0b}
.cocs-widget[data-attention="1"] .cocs-launcher:before,.cocs-widget[data-attention="1"] .cocs-launcher:after{content:"";position:absolute;inset:-8px;border:2px solid rgba(37,99,235,.35);border-radius:999px;opacity:0;animation:cocsPulse 3s infinite}
.cocs-widget[data-attention="1"] .cocs-launcher:after{animation-delay:1.4s}
@keyframes cocsPulse{0%{transform:scale(.94);opacity:.55}75%,100%{transform:scale(1.18);opacity:0}}
.cocs-panel{position:absolute;width:min(var(--cocs-width),calc(100vw - 24px));min-width:min(460px,calc(100vw - 24px));max-height:min(760px,calc(100vh - 110px));display:flex;flex-direction:column;overflow:hidden;border:1px solid rgba(226,232,240,.9);border-radius:var(--cocs-radius);background:#fff;box-shadow:0 24px 80px rgba(15,23,42,.24),0 8px 24px rgba(15,23,42,.08);opacity:0;visibility:hidden;transform:translateY(12px) scale(.98);transition:opacity .2s ease,transform .2s ease,visibility .2s ease}
.cocs-pos-right-bottom .cocs-panel,.cocs-pos-left-bottom .cocs-panel{bottom:calc(var(--cocs-launcher) + 16px)}.cocs-pos-right-top .cocs-panel,.cocs-pos-left-top .cocs-panel{top:calc(var(--cocs-launcher) + 16px)}.cocs-pos-right-bottom .cocs-panel,.cocs-pos-right-center .cocs-panel,.cocs-pos-right-top .cocs-panel{right:0}.cocs-pos-left-bottom .cocs-panel,.cocs-pos-left-center .cocs-panel,.cocs-pos-left-top .cocs-panel{left:0}.cocs-pos-right-center .cocs-panel,.cocs-pos-left-center .cocs-panel{top:50%;transform:translateY(-50%) translateY(12px) scale(.98)}.cocs-widget.is-open .cocs-panel,.cocs-embedded .cocs-panel{opacity:1;visibility:visible;transform:none}.cocs-embedded .cocs-panel{position:relative;width:100%;max-height:none}.cocs-mode-expanded:not(.cocs-embedded) .cocs-launcher{display:none}.cocs-mode-expanded:not(.cocs-embedded) .cocs-panel{position:relative;opacity:1;visibility:visible;transform:none}
.cocs-panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:18px 18px 16px;background:linear-gradient(135deg,#0f172a 0%,var(--cocs-primary) 100%);color:var(--cocs-head-text)}
.cocs-head-agent{display:flex;align-items:center;gap:12px;min-width:0}.cocs-head-agent img,.cocs-avatar-fallback{width:48px;height:48px;flex:0 0 48px;border-radius:50%;object-fit:cover;background:rgba(255,255,255,.16);display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:900;border:2px solid rgba(255,255,255,.18)}.cocs-head-agent div{min-width:0}.cocs-head-agent strong,.cocs-head-agent small{display:block}.cocs-head-agent strong{font-size:18px;line-height:1.2}.cocs-head-agent small{margin-top:4px;font-size:12px;opacity:.9;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cocs-close{width:34px;height:34px;flex:0 0 34px;border:1px solid rgba(255,255,255,.18);border-radius:50%;background:rgba(255,255,255,.12);color:inherit;font-size:22px;cursor:pointer;line-height:1}
.cocs-welcome{margin:14px 14px 0;padding:13px 14px;border-radius:16px;background:#f8fafc;border:1px solid #e9eef5;color:#475569;font-size:13px}.cocs-license-warning{margin:12px 14px 0;padding:10px 14px;border-radius:14px;background:#fff7ed;color:#9a3412;font-size:12px;border:1px solid #fed7aa}
.cocs-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;padding:14px 14px 0;background:#fff;border:0}.cocs-tabs button{padding:10px 8px;border:1px solid #e2e8f0;border-radius:14px;background:#fff;color:#64748b;font-size:12px;font-weight:800;cursor:pointer;transition:all .16s ease}.cocs-tabs button.is-active{background:#eff6ff;border-color:#bfdbfe;color:var(--cocs-primary);box-shadow:0 6px 16px rgba(37,99,235,.08)}
.cocs-tab-panels{min-height:250px;overflow:auto;background:#fff;padding:14px}.cocs-tab-panel{display:none}.cocs-tab-panel.is-active{display:block}
.cocs-agent-list{display:grid;gap:10px;margin-bottom:14px}.cocs-agent-card{display:flex;align-items:center;gap:10px;padding:11px 12px;border:1px solid #edf2f7;border-radius:16px;background:linear-gradient(180deg,#fff 0%,#f8fafc 100%)}.cocs-agent-card img,.cocs-agent-card>span{width:38px;height:38px;flex:0 0 38px;border-radius:50%;object-fit:cover;display:flex;align-items:center;justify-content:center;background:#dbeafe;color:#1d4ed8;font-weight:900}.cocs-agent-card strong,.cocs-agent-card small{display:block}.cocs-agent-card strong{font-size:14px}.cocs-agent-card small{font-size:11px;color:#64748b}
.cocs-channel-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.cocs-channel{appearance:none;width:100%;display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:14px;border:1px solid #e5eaf1;border-radius:18px;background:linear-gradient(180deg,#fff 0%,#f8fafc 100%);color:#0f172a;text-decoration:none;text-align:left;cursor:pointer;transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease;min-height:122px;position:relative}.cocs-channel:hover{border-color:#bfdbfe;box-shadow:0 12px 22px rgba(15,23,42,.08);transform:translateY(-2px)}.cocs-channel-icon{display:flex;align-items:center;justify-content:center;width:44px;height:44px;flex:0 0 44px;border-radius:14px;background:#eff6ff;color:#2563eb;font-weight:900}.cocs-channel-icon svg{width:22px;height:22px;display:block}.cocs-channel-text{min-width:0;display:grid;gap:4px}.cocs-channel-text strong{font-size:14px;line-height:1.2}.cocs-channel-text small{color:#64748b;font-size:11px;line-height:1.4}.cocs-arrow,.cocs-qr-trigger{position:absolute;right:12px;top:12px;color:#94a3b8;font-size:18px;line-height:1}.cocs-qr-trigger{font-size:10px;border-radius:999px;padding:4px 8px;background:#eef2ff;color:#4f46e5}.cocs-channel[data-channel="wechat"] .cocs-channel-icon{background:#eafaf0;color:#16a34a}.cocs-channel[data-channel="qq"] .cocs-channel-icon{background:#eef6ff;color:#2563eb}.cocs-channel[data-channel="phone"] .cocs-channel-icon{background:#fff7ed;color:#ea580c}.cocs-channel[data-channel="email"] .cocs-channel-icon{background:#eef2ff;color:#4338ca}.cocs-channel[data-channel="telegram"] .cocs-channel-icon{background:#ecfeff;color:#0891b2}.cocs-channel[data-channel="whatsapp"] .cocs-channel-icon{background:#ecfdf5;color:#16a34a}.cocs-channel[data-channel="backtop"] .cocs-channel-icon{background:#f8fafc;color:#111827}
.cocs-ticket-form,.cocs-ticket-lookup,.cocs-visitor-reply{display:grid;gap:11px}.cocs-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.cocs-widget label{display:grid;gap:6px;color:#334155;font-size:12px;font-weight:700}.cocs-widget input,.cocs-widget select,.cocs-widget textarea{width:100%;min-height:42px;margin:0;padding:10px 12px;border:1px solid #d7dee8;border-radius:12px;background:#fff;color:#0f172a;outline:none;box-shadow:none}.cocs-widget input:focus,.cocs-widget select:focus,.cocs-widget textarea:focus{border-color:#93c5fd;box-shadow:0 0 0 3px rgba(37,99,235,.12)}.cocs-widget textarea{min-height:104px;resize:vertical}.cocs-widget label small{color:#94a3b8;font-weight:500}.cocs-consent{display:flex!important;align-items:flex-start!important;grid-template-columns:auto 1fr!important;gap:8px!important;line-height:1.5}.cocs-consent input{width:16px!important;height:16px!important;min-height:0!important;margin-top:2px!important}.cocs-primary{min-height:44px;border:0;border-radius:13px;background:linear-gradient(135deg,#2563eb 0%,#1d4ed8 100%);color:#fff;font-weight:850;cursor:pointer;box-shadow:0 12px 20px rgba(37,99,235,.18)}.cocs-primary:disabled{opacity:.55;cursor:wait}.cocs-honeypot{position:absolute!important;left:-9999px!important}.cocs-form-result{font-size:12px;line-height:1.6}.cocs-form-result.is-success{padding:10px;border-radius:10px;background:#ecfdf5;color:#047857}.cocs-form-result.is-error,.cocs-error{color:#b91c1c}
.cocs-faq-search{display:flex;gap:8px}.cocs-faq-search input{flex:1}.cocs-faq-search button{min-width:70px;border:0;border-radius:12px;background:#0f172a;color:#fff;font-weight:800}.cocs-faq-list{display:grid;gap:10px;margin-top:12px}.cocs-faq-item{border:1px solid #e5eaf1;border-radius:15px;overflow:hidden;background:#fff}.cocs-faq-item>button{display:flex;align-items:center;justify-content:space-between;width:100%;padding:13px 14px;border:0;background:#fff;text-align:left;font-weight:800;color:#1e293b;cursor:pointer}.cocs-faq-item>button b{font-size:18px;color:#64748b}.cocs-faq-item>div{display:none;padding:0 14px 14px;color:#475569;font-size:12px;line-height:1.75}.cocs-faq-item.is-open>div{display:block}.cocs-faq-item.is-open>button b{transform:rotate(45deg)}
.cocs-empty{text-align:center;color:#94a3b8;font-size:12px;padding:18px 6px}.cocs-ticket-detail{margin-top:13px}.cocs-ticket-summary{display:grid;gap:5px;padding:13px 14px;border-radius:14px;background:#f8fafc;border:1px solid #e5eaf1}.cocs-ticket-summary strong{font-size:13px}.cocs-ticket-summary span{width:max-content;padding:4px 9px;border-radius:999px;background:#dbeafe;color:#1d4ed8;font-size:10px;font-weight:800}.cocs-ticket-summary small{color:#64748b}.cocs-conversation{display:grid;gap:10px;margin:12px 0}.cocs-message{max-width:88%;padding:11px 12px;border-radius:15px;background:#f1f5f9;font-size:12px}.cocs-message.is-admin,.cocs-message.is-system{margin-left:auto;background:#eff6ff}.cocs-message header{display:flex;justify-content:space-between;gap:8px;margin-bottom:6px}.cocs-message header time{color:#94a3b8;font-size:10px}.cocs-message p{margin:0 0 6px}.cocs-message footer{display:flex;flex-wrap:wrap;gap:5px;margin-top:7px}.cocs-message footer a{font-size:10px}
.cocs-qr-modal{position:absolute;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;padding:22px;background:rgba(248,250,252,.96);backdrop-filter:blur(8px);border-radius:inherit;color:#0f172a;overflow:auto}.cocs-qr-modal[hidden]{display:none!important}.cocs-qr-card{width:100%;max-width:300px;padding:22px;border:1px solid #e2e8f0;border-radius:22px;background:#fff;text-align:center;box-shadow:0 20px 50px rgba(15,23,42,.14)}.cocs-qr-kicker{display:inline-flex;margin-bottom:7px;padding:4px 9px;border-radius:999px;background:#ecfdf5;color:#15803d;font-size:10px;font-weight:850;letter-spacing:.08em}.cocs-qr-title{display:block;font-size:18px;color:#0f172a}.cocs-qr-image-wrap{display:flex;align-items:center;justify-content:center;width:220px;max-width:100%;aspect-ratio:1;margin:16px auto 12px;padding:10px;border:1px solid #dcfce7;border-radius:18px;background:#f0fdf4}.cocs-qr-modal img{display:block;width:100%;height:100%;object-fit:contain;border-radius:10px;background:#fff}.cocs-qr-caption{margin:0;color:#64748b;font-size:12px;line-height:1.65;word-break:break-all}.cocs-qr-copy{display:inline-flex;align-items:center;justify-content:center;min-height:40px;margin-top:14px;padding:0 16px;border:0;border-radius:12px;background:#16a34a;color:#fff;font-weight:800;cursor:pointer}.cocs-qr-copy[hidden]{display:none!important}.cocs-qr-close{position:absolute;right:14px;top:14px;display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:1px solid #e2e8f0;border-radius:50%;background:#fff;color:#475569;font-size:22px;line-height:1;box-shadow:0 8px 20px rgba(15,23,42,.08);cursor:pointer}.cocs-qr-close:hover{color:#0f172a;background:#f8fafc}.cocs-widget code{padding:2px 5px;border-radius:5px;background:#e2e8f0;color:#0f172a}
.cocs-svg-icon{display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%}
@media(max-width:600px){.cocs-widget:not(.cocs-embedded){left:10px!important;right:10px!important;bottom:12px!important;top:auto!important;transform:none!important}.cocs-launcher{margin-left:auto}.cocs-panel{position:fixed!important;left:10px!important;right:10px!important;bottom:10px!important;top:auto!important;width:auto!important;min-width:0!important;max-height:calc(100vh - 20px);transform:translateY(20px) scale(.98)!important}.cocs-widget.is-open .cocs-panel{transform:none!important}.cocs-form-grid,.cocs-channel-list{grid-template-columns:1fr}.cocs-tabs{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(prefers-color-scheme:dark){.cocs-widget .cocs-panel{color-scheme:light}}

.cocs-member-tickets{overflow:auto}.cocs-member-tickets table{width:100%;border-collapse:collapse;background:#fff}.cocs-member-tickets th,.cocs-member-tickets td{padding:12px;border:1px solid #e5e7eb;text-align:left}.cocs-member-tickets th{background:#f8fafc}.cocs-member-tickets p{color:#64748b;font-size:13px}

/* v0.2.0 contact actions and live chat */
.cocs-contact-modal{position:absolute;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;padding:18px;background:rgba(241,245,249,.94);backdrop-filter:blur(10px);border-radius:var(--cocs-radius);overflow:auto}
.cocs-contact-modal[hidden]{display:none!important}
.cocs-contact-close{position:absolute;right:13px;top:13px;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border:1px solid #e2e8f0;border-radius:50%;background:#fff;color:#64748b;font-size:22px;line-height:1;cursor:pointer;box-shadow:0 5px 16px rgba(15,23,42,.08)}
.cocs-contact-card{width:100%;max-width:310px;padding:22px 20px 18px;border:1px solid rgba(226,232,240,.95);border-radius:22px;background:#fff;text-align:center;box-shadow:0 20px 50px rgba(15,23,42,.13)}
.cocs-contact-kicker{display:inline-flex;margin-bottom:9px;padding:4px 9px;border-radius:999px;background:#ecfdf5;color:#15803d;font-size:10px;font-weight:850}
.cocs-contact-title{display:block;color:#0f172a;font-size:18px;line-height:1.3}
.cocs-contact-description{margin:8px 0 14px;color:#64748b;font-size:12px;line-height:1.7}
.cocs-contact-qr-wrap{display:flex;align-items:center;justify-content:center;margin:0 auto 12px;padding:10px;width:min(220px,100%);border:1px solid #dcfce7;border-radius:20px;background:#f0fdf4}
.cocs-contact-qr-wrap[hidden]{display:none!important}
.cocs-contact-qr-wrap img{display:block;width:100%;height:auto;max-height:210px;object-fit:contain;border-radius:12px;background:#fff}
.cocs-contact-value{margin:10px 0;padding:11px 12px;border:1px dashed #cbd5e1;border-radius:13px;background:#f8fafc;word-break:break-all}
.cocs-contact-value[hidden]{display:none!important}
.cocs-contact-value code{display:block;padding:0;background:transparent;color:#0f172a;font-size:14px;font-weight:800}
.cocs-contact-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:13px}
.cocs-contact-actions button{min-height:42px;padding:9px 10px;border-radius:12px;font-weight:800;cursor:pointer}
.cocs-contact-primary{border:0;background:var(--cocs-primary);color:#fff;box-shadow:0 9px 18px rgba(37,99,235,.18)}
.cocs-contact-copy{border:1px solid #d7dee8;background:#fff;color:#334155}
.cocs-contact-actions button[hidden]{display:none!important}
.cocs-contact-actions button:only-child{grid-column:1/-1}
.cocs-contact-tip{display:block;margin-top:12px;color:#94a3b8;font-size:10px;line-height:1.6}
.cocs-toast{position:absolute;right:8px;bottom:calc(var(--cocs-launcher) + 12px);z-index:60;max-width:270px;padding:11px 14px;border:1px solid #bbf7d0;border-radius:12px;background:#ecfdf5;color:#047857;font-size:12px;font-weight:800;box-shadow:0 14px 34px rgba(15,23,42,.17);opacity:0;transform:translateY(8px);transition:opacity .18s ease,transform .18s ease;pointer-events:none}
.cocs-toast[hidden]{display:none!important}.cocs-toast.is-visible{opacity:1;transform:none}.cocs-toast.is-error{border-color:#fecaca;background:#fef2f2;color:#b91c1c}.cocs-toast.is-info{border-color:#bfdbfe;background:#eff6ff;color:#1d4ed8}
.cocs-pos-left-bottom .cocs-toast,.cocs-pos-left-center .cocs-toast,.cocs-pos-left-top .cocs-toast{left:8px;right:auto}
.cocs-live-chat{min-height:250px}
.cocs-chat-start-view[hidden],.cocs-chat-room[hidden],.cocs-chat-send-form[hidden]{display:none!important}
.cocs-chat-intro{display:flex;align-items:flex-start;gap:11px;margin-bottom:14px;padding:13px;border:1px solid #dbeafe;border-radius:17px;background:linear-gradient(135deg,#eff6ff,#fff)}
.cocs-chat-intro-avatar{display:flex;align-items:center;justify-content:center;width:42px;height:42px;flex:0 0 42px;border-radius:50%;overflow:hidden;background:var(--cocs-primary);color:#fff;font-size:12px;font-weight:900}
.cocs-chat-intro-avatar img{display:block;width:100%;height:100%;object-fit:cover}
.cocs-chat-intro strong{display:block;color:#0f172a;font-size:14px}.cocs-chat-intro p{margin:4px 0 0;color:#64748b;font-size:11px;line-height:1.6}
.cocs-chat-start-form{display:grid;gap:11px}
.cocs-chat-room{display:grid;grid-template-rows:auto minmax(210px,1fr) auto;min-height:420px;max-height:520px;border:1px solid #e2e8f0;border-radius:17px;overflow:hidden;background:#f8fafc}
.cocs-chat-room-head{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:11px 13px;border-bottom:1px solid #e2e8f0;background:#fff}
.cocs-chat-room-head strong,.cocs-chat-room-head small{display:block}.cocs-chat-room-head strong{font-size:13px;color:#0f172a}.cocs-chat-room-head small{margin-top:2px;color:#94a3b8;font-size:9px}
.cocs-chat-end{padding:6px 9px;border:1px solid #e2e8f0;border-radius:9px;background:#fff;color:#64748b;font-size:10px;font-weight:750;cursor:pointer}
.cocs-chat-messages{display:flex;flex-direction:column;gap:10px;min-height:210px;padding:13px;overflow:auto;scroll-behavior:smooth}
.cocs-chat-message{align-self:flex-start;max-width:86%;padding:10px 12px;border:1px solid #e2e8f0;border-radius:15px 15px 15px 5px;background:#fff;color:#334155;font-size:12px;box-shadow:0 4px 12px rgba(15,23,42,.04)}
.cocs-chat-message.is-visitor{align-self:flex-end;border-color:#bfdbfe;border-radius:15px 15px 5px 15px;background:#eff6ff;color:#1e3a8a}
.cocs-chat-message.is-system{align-self:center;max-width:94%;padding:7px 10px;border:0;border-radius:999px;background:#e2e8f0;color:#64748b;text-align:center;font-size:10px;box-shadow:none}
.cocs-chat-message header{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:5px}.cocs-chat-message header strong{font-size:10px}.cocs-chat-message header time{color:#94a3b8;font-size:8px}.cocs-chat-message>div{line-height:1.7;word-break:break-word}.cocs-chat-message>div p{margin:0 0 6px}.cocs-chat-message footer{display:flex;flex-wrap:wrap;gap:5px;margin-top:7px}.cocs-chat-message footer a{padding:3px 6px;border-radius:7px;background:#fff;color:#2563eb;font-size:9px;text-decoration:none}
.cocs-chat-send-form{display:grid;gap:7px;padding:10px;border-top:1px solid #e2e8f0;background:#fff}
.cocs-chat-send-form textarea{min-height:68px;max-height:130px;border-radius:11px;resize:vertical}
.cocs-chat-compose-row{display:flex;align-items:center;justify-content:space-between;gap:8px}
.cocs-chat-compose-row .cocs-primary{min-width:82px;min-height:38px}
.cocs-chat-attach{display:inline-flex!important;align-items:center!important;margin:0!important;padding:7px 10px;border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc;color:#64748b!important;font-size:10px!important;cursor:pointer}
.cocs-chat-attach input{position:absolute!important;width:1px!important;height:1px!important;min-height:0!important;opacity:0!important;pointer-events:none}
@media(max-width:600px){.cocs-contact-modal{position:fixed;left:10px;right:10px;top:10px;bottom:10px;inset:10px;border-radius:22px}.cocs-contact-card{max-width:330px}.cocs-toast{position:fixed;right:18px;left:18px;bottom:24px;max-width:none;text-align:center}.cocs-chat-room{min-height:380px;max-height:calc(100vh - 190px)}}


/* v0.4.0: independent realtime chat and ticket workflows. */
.cocs-service-status{display:flex;align-items:center;gap:8px;margin:13px 14px 0;padding:10px 12px;border:1px solid #e5eaf1;border-radius:14px;background:#f8fafc;color:#64748b;font-size:11px}.cocs-service-status i{width:9px;height:9px;flex:0 0 9px;border-radius:50%}.cocs-service-status i.is-online{background:#22c55e;box-shadow:0 0 0 4px rgba(34,197,94,.12)}.cocs-service-status i.is-away{background:#f59e0b;box-shadow:0 0 0 4px rgba(245,158,11,.12)}
.cocs-tabs{grid-template-columns:repeat(3,minmax(0,1fr))}
.cocs-contact-guidance{display:grid;gap:3px;margin-bottom:12px;padding:11px 12px;border:1px solid #dbeafe;border-radius:15px;background:#eff6ff}.cocs-contact-guidance strong{font-size:13px;color:#1e3a8a}.cocs-contact-guidance span{font-size:11px;color:#64748b}
.cocs-chat-room{min-height:430px}.cocs-chat-placeholder{border-radius:14px!important}.cocs-chat-identity{max-width:250px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cocs-chat-compose-row small{flex:1;color:#94a3b8;font-size:9px;text-align:center}.cocs-chat-captcha:empty{display:none}.cocs-chat-captcha>div{margin:0 auto}.cocs-chat-end[hidden]{display:none!important}
.cocs-ticket-mode-nav{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:12px;padding:4px;border-radius:13px;background:#f1f5f9}.cocs-ticket-mode-nav button{min-height:36px;border:0;border-radius:10px;background:transparent;color:#64748b;font-size:11px;font-weight:800;cursor:pointer}.cocs-ticket-mode-nav button.is-active{background:#fff;color:var(--cocs-primary);box-shadow:0 4px 12px rgba(15,23,42,.08)}.cocs-ticket-mode{display:none}.cocs-ticket-mode.is-active{display:block}.cocs-ticket-create{display:grid;gap:11px}.cocs-ticket-detail:not(:empty){margin-top:13px;padding-top:13px;border-top:1px solid #e5eaf1}
@media(max-width:600px){.cocs-tabs{grid-template-columns:repeat(3,minmax(0,1fr))}.cocs-chat-room{min-height:420px}.cocs-chat-compose-row{flex-wrap:wrap}.cocs-chat-compose-row small{order:3;flex-basis:100%}}

/* v0.5 client chat avatars and bubble layout */
.cocs-chat-message{display:flex;align-items:flex-start;gap:8px;align-self:flex-start;max-width:92%;padding:0;border:0;border-radius:0;background:transparent;color:#334155;box-shadow:none}
.cocs-chat-message.is-visitor{align-self:flex-end;flex-direction:row-reverse;border:0;background:transparent;color:#1e3a8a}
.cocs-chat-message.is-system{align-self:flex-start;max-width:92%;padding:0;border:0;border-radius:0;background:transparent;color:#64748b;text-align:left;font-size:12px}
.cocs-chat-avatar{width:30px;height:30px;flex:0 0 30px;border-radius:50%;object-fit:cover;background:#e2e8f0;border:1px solid #dbe3ef;box-shadow:0 2px 6px rgba(15,23,42,.08)}
.cocs-chat-bubble{min-width:0;padding:10px 12px;border:1px solid #e2e8f0;border-radius:15px 15px 15px 5px;background:#fff;box-shadow:0 4px 12px rgba(15,23,42,.04)}
.cocs-chat-message.is-visitor .cocs-chat-bubble{border-color:#bfdbfe;border-radius:15px 15px 5px 15px;background:#eff6ff}
.cocs-chat-message.is-system .cocs-chat-bubble{border-color:#e2e8f0;background:#f8fafc}
.cocs-chat-message .cocs-chat-bubble>div{line-height:1.7;word-break:break-word}
.cocs-chat-message .cocs-chat-bubble>div p{margin:0 0 6px}
.cocs-chat-message .cocs-chat-bubble footer{display:flex;flex-wrap:wrap;gap:5px;margin-top:7px}
.cocs-chat-message .cocs-chat-bubble footer a{padding:3px 6px;border-radius:7px;background:#fff;color:#2563eb;font-size:9px;text-decoration:none}

/* v0.9.5 emoji, image and notification-sound controls */
.cocs-chat-room-head>div:first-child{min-width:0}.cocs-chat-head-actions{display:flex;align-items:center;gap:7px;flex:0 0 auto;flex-wrap:nowrap}.cocs-chat-head-actions button{white-space:nowrap}.cocs-chat-sound-toggle{padding:5px 8px;border:1px solid #e2e8f0;border-radius:9px;background:#fff;color:#64748b;font-size:9px;font-weight:750;cursor:pointer}.cocs-chat-sound-toggle[aria-pressed="true"]{color:#94a3b8;background:#f8fafc}
.cocs-chat-compose-tools{position:relative;display:flex;align-items:center;gap:5px}.cocs-chat-tool-button{display:inline-flex!important;align-items:center!important;justify-content:center;width:36px;height:36px;min-height:36px;margin:0!important;padding:0!important;border:0!important;border-radius:9px;background:transparent!important;color:#334155!important;cursor:pointer;transition:background .16s ease,color .16s ease,transform .16s ease}.cocs-chat-tool-button:hover{background:#eef2f7!important;color:var(--cocs-primary)!important}.cocs-chat-tool-button:active{transform:scale(.94)}.cocs-chat-tool-button:focus-visible{outline:2px solid #93c5fd;outline-offset:2px}.cocs-chat-tool-icon{display:inline-flex;width:22px;height:22px}.cocs-chat-tool-icon svg{display:block;width:100%;height:100%}.cocs-chat-image-button{position:relative}.cocs-chat-image-button input{position:absolute!important;width:1px!important;height:1px!important;min-height:0!important;opacity:0!important;pointer-events:none}.screen-reader-text{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.cocs-chat-emoji-panel{position:absolute;left:0;bottom:39px;z-index:8;display:grid;grid-template-columns:repeat(6,34px);gap:4px;padding:8px;border:1px solid #dbe3ef;border-radius:14px;background:#fff;box-shadow:0 14px 38px rgba(15,23,42,.18)}.cocs-chat-emoji-panel[hidden]{display:none!important}.cocs-chat-emoji-panel button{width:34px;height:34px;padding:0;border:0;border-radius:8px;background:transparent;font-size:20px;cursor:pointer}.cocs-chat-emoji-panel button:hover{background:#eff6ff}
.cocs-chat-image-preview{display:flex;gap:7px;overflow:auto;padding:5px 0}.cocs-chat-image-preview[hidden]{display:none!important}.cocs-chat-image-preview span{width:54px;height:54px;flex:0 0 54px;overflow:hidden;border:1px solid #dbe3ef;border-radius:10px;background:#f8fafc}.cocs-chat-image-preview img{display:block;width:100%;height:100%;object-fit:cover}
.cocs-chat-bubble footer .cocs-chat-image{display:block;width:min(210px,100%);padding:0;overflow:hidden;border-radius:10px;background:transparent}.cocs-chat-bubble footer .cocs-chat-image img{display:block;width:100%;height:auto;max-height:240px;object-fit:cover;border-radius:10px}
@media(max-width:600px){.cocs-chat-emoji-panel{grid-template-columns:repeat(6,32px)}.cocs-chat-emoji-panel button{width:32px;height:32px}.cocs-chat-sound-toggle{padding:5px 7px}}

/* v0.9.5 wider client chat and icon toolbar */
@media(min-width:601px){.cocs-chat-room{min-height:440px}.cocs-chat-messages{min-height:250px}.cocs-chat-send-form textarea{min-height:82px}}

/* v0.9.5: peer typing indicator and exact emoji hit areas. */
.cocs-chat-emoji-panel .cocs-chat-emoji-choice{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  flex:0 0 34px!important;
  width:34px!important;
  min-width:34px!important;
  max-width:34px!important;
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  margin:0!important;
  padding:0!important;
  box-sizing:border-box!important;
  line-height:1!important;
}
.cocs-chat-peer-typing{display:flex;align-items:center;gap:7px;min-height:20px;margin:-1px 0 0;padding:0 3px;color:#64748b;font-size:10px}
.cocs-chat-peer-typing[hidden]{display:none!important}
.cocs-chat-peer-typing>span{display:inline-flex;align-items:center;gap:3px}
.cocs-chat-peer-typing b{font-size:10px;font-weight:600;color:#64748b}
.cocs-chat-peer-typing i{display:block;width:4px;height:4px;border-radius:50%;background:var(--cocs-primary);animation:cocsClientTypingDot 1.05s infinite ease-in-out}
.cocs-chat-peer-typing i:nth-child(2){animation-delay:.15s}.cocs-chat-peer-typing i:nth-child(3){animation-delay:.3s}
@keyframes cocsClientTypingDot{0%,70%,100%{transform:translateY(0);opacity:.38}35%{transform:translateY(-3px);opacity:1}}


/* v0.9.5 composer alignment and empty-state cleanup. */
.cocs-chat-send-form{padding:10px 12px!important;gap:7px!important}
.cocs-chat-send-form .cocs-form-result:empty{display:none!important}
.cocs-chat-compose-row{min-height:40px!important;align-items:center!important;margin:0!important;padding:0!important}
.cocs-chat-compose-row .cocs-primary{align-self:center!important;height:38px!important;min-height:38px!important;margin:0!important;padding:0 18px!important;line-height:38px!important}
.cocs-chat-compose-row small{align-self:center!important;line-height:1.4!important;margin:0!important}

/* v0.9.6: align the client chat with the agent workspace conversation pane. */
@media (min-width: 601px) {
  .cocs-widget:not(.cocs-embedded) .cocs-panel {
    width: min(720px, calc(100vw - 32px)) !important;
    min-width: min(720px, calc(100vw - 32px)) !important;
  }
  .cocs-widget:not(.cocs-embedded) .cocs-chat-room {
    min-height: 500px;
    max-height: min(700px, calc(100vh - 245px));
  }
  .cocs-widget:not(.cocs-embedded) .cocs-chat-messages {
    min-height: 300px;
  }
}

/* Match the agent frame header actions exactly. */
.cocs-chat-sound-toggle,
.cocs-chat-end {
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  margin: 0 !important;
  padding: 6px 9px !important;
  border: 1px solid #dbe3ef !important;
  border-radius: 9px !important;
  background: #fff !important;
  color: #64748b !important;
  box-shadow: none !important;
  font-size: 10px !important;
  font-weight: 400 !important;
  line-height: 1.45 !important;
  white-space: nowrap !important;
}
.cocs-chat-sound-toggle[aria-pressed="true"] {
  background: #f8fafc !important;
  color: #94a3b8 !important;
}

/* Match the agent frame composer footer. */
.cocs-chat-send-form {
  padding: 10px 12px !important;
  gap: 7px !important;
}
.cocs-chat-compose-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  min-height: 36px !important;
  margin: 8px 0 0 !important;
  padding: 0 !important;
}
.cocs-chat-compose-row small {
  flex: 1 1 auto !important;
  align-self: center !important;
  margin: 0 !important;
  padding: 0 !important;
  color: #94a3b8 !important;
  font-size: 9px !important;
  line-height: 1.45 !important;
  text-align: left !important;
}
.cocs-chat-compose-row .cocs-primary {
  flex: 0 0 auto !important;
  align-self: center !important;
  min-width: 84px !important;
  width: auto !important;
  height: 36px !important;
  min-height: 36px !important;
  margin: 0 !important;
  padding: 0 18px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: #2563eb !important;
  color: #fff !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 36px !important;
}
.cocs-chat-compose-row .cocs-primary:hover {
  background: #1d4ed8 !important;
  box-shadow: none !important;
  transform: none !important;
}
.cocs-chat-send-form .cocs-form-result:empty {
  display: none !important;
}

@media (max-width: 600px) {
  .cocs-chat-compose-row {
    flex-wrap: nowrap !important;
    min-height: 36px !important;
  }
  .cocs-chat-compose-row small {
    order: initial !important;
    flex-basis: auto !important;
  }
  .cocs-chat-compose-row .cocs-primary {
    min-width: 78px !important;
    padding: 0 15px !important;
  }
}


/* v0.9.7: one scrollbar in chat mode, narrower desktop width, and tab-aware adaptive height. */
@media (min-width: 601px) {
  .cocs-widget:not(.cocs-embedded) .cocs-panel {
    width: min(640px, calc(100vw - 32px)) !important;
    min-width: min(640px, calc(100vw - 32px)) !important;
    max-height: calc(100vh - 24px) !important;
  }

  /* Chat owns the available height. Only the message stream may scroll. */
  .cocs-widget.cocs-view-chat:not(.cocs-embedded) .cocs-tab-panels {
    display: flex !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 0 14px 14px !important;
  }
  .cocs-widget.cocs-view-chat .cocs-tab-panel[data-panel="chat"] {
    display: block !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
  }
  .cocs-widget.cocs-view-chat .cocs-live-chat {
    height: 100% !important;
    min-height: 0 !important;
  }
  .cocs-widget.cocs-view-chat:not(.cocs-embedded) .cocs-chat-room {
    height: min(700px, calc(100vh - 280px)) !important;
    min-height: 430px !important;
    max-height: none !important;
  }
  .cocs-widget.cocs-view-chat .cocs-chat-messages {
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  /* Contact and ticket panels grow with their content, then scroll only when needed. */
  .cocs-widget.cocs-view-contact:not(.cocs-embedded) .cocs-tab-panels,
  .cocs-widget.cocs-view-ticket:not(.cocs-embedded) .cocs-tab-panels {
    flex: 0 1 auto !important;
    min-height: 0 !important;
    max-height: calc(100vh - 260px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 14px !important;
    overscroll-behavior: contain;
  }
}

@media (min-width: 601px) and (max-height: 720px) {
  .cocs-widget.cocs-view-chat:not(.cocs-embedded) .cocs-chat-room {
    height: calc(100vh - 250px) !important;
    min-height: 340px !important;
  }
}

@media (max-width: 600px) {
  .cocs-widget.cocs-view-chat .cocs-tab-panels {
    overflow: hidden !important;
    padding: 0 10px 10px !important;
  }
  .cocs-widget.cocs-view-chat .cocs-chat-room {
    height: calc(100vh - 205px) !important;
    min-height: 360px !important;
    max-height: none !important;
  }
  .cocs-widget.cocs-view-contact .cocs-tab-panels,
  .cocs-widget.cocs-view-ticket .cocs-tab-panels {
    overflow-y: auto !important;
    padding: 10px !important;
  }
}
