:root{--cw-brand:#0b6e4f;--cw-bg:#fff;--cw-line:#dde3e8;--cw-muted:#5c6670}
#chatWidgetRoot{position:fixed;right:16px;bottom:16px;z-index:9999;font-family:'Noto Sans JP',sans-serif}
#chatWidgetBtn{width:56px;height:56px;border-radius:999px;border:none;background:var(--cw-brand);color:#fff;font-size:14px;font-weight:700;box-shadow:0 8px 24px rgba(11,110,79,.35);cursor:pointer}
#chatWidgetPanel{display:none;position:absolute;right:0;bottom:68px;width:min(360px,calc(100vw - 32px));height:min(520px,calc(100dvh - 120px));max-height:calc(100dvh - 120px);background:var(--cw-bg);border:1px solid var(--cw-line);border-radius:16px;box-shadow:0 12px 40px rgba(0,0,0,.15);flex-direction:column;overflow:hidden}
#chatWidgetPanel.open{display:flex}
.cw-header{flex-shrink:0;display:flex;align-items:center;gap:10px;padding:10px 14px;background:var(--cw-brand);color:#fff;font-weight:700}
.cw-header-avatar{width:34px;height:34px;border-radius:999px;object-fit:cover;background:#fff;border:1px solid rgba(255,255,255,.6)}
.cw-header-title{flex:1;font-size:15px}
.cw-header-close{background:transparent;border:0;color:#fff;cursor:pointer;font-size:20px;line-height:1;padding:0 4px}
.cw-messages{flex:1;min-height:0;overflow-y:auto;padding:12px;background:#f6f8fa;-webkit-overflow-scrolling:touch}
.cw-row{display:flex;align-items:flex-end;gap:8px;margin:0 0 10px}
.cw-row.user{justify-content:flex-end}
.cw-row.bot{justify-content:flex-start}
.cw-avatar{flex-shrink:0;width:34px;height:34px;border-radius:999px;object-fit:cover;background:#fff;border:1px solid var(--cw-line)}
.cw-bubble-wrap{max-width:calc(100% - 46px)}
.cw-msg{margin:0;max-width:100%;padding:10px 12px;border-radius:14px;line-height:1.6;font-size:14px;white-space:pre-wrap;word-break:break-word}
.cw-row.user .cw-msg{max-width:88%}
.cw-msg.user{background:#ecfeff;border:1px solid #99f6e4}
.cw-msg.bot{background:#fff;border:1px solid var(--cw-line)}
.cw-typing{display:inline-flex;flex-direction:column;align-items:flex-start;gap:8px;padding:12px 14px}
.cw-status-text{font-size:13px;color:var(--cw-muted);line-height:1.4}
.cw-typing-dots{display:inline-flex;align-items:center;gap:5px}
.cw-dot{width:7px;height:7px;border-radius:999px;background:#9aa5b1;animation:cwBlink 1.3s infinite ease-in-out both}
.cw-dot:nth-child(2){animation-delay:.18s}
.cw-dot:nth-child(3){animation-delay:.36s}
@keyframes cwBlink{0%,80%,100%{opacity:.25;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}
.cw-actions{flex-shrink:0;display:flex;flex-wrap:wrap;gap:6px;padding:8px 10px;border-top:1px solid var(--cw-line);background:#fff}
.cw-actions button{flex:1 1 auto;padding:8px 10px;border:1px solid var(--cw-line);border-radius:999px;background:#fff;font-size:12px;cursor:pointer}
.cw-actions button.cw-action-end{flex:1 1 100%;color:#64748b;border-color:#cbd5e1;background:#f8fafc}
.cw-input-row{flex-shrink:0;display:flex;gap:8px;padding:10px;border-top:1px solid var(--cw-line);background:#fff}
.cw-input-row input{flex:1;min-width:0;padding:10px 12px;border:1px solid var(--cw-line);border-radius:10px;font-size:16px}
.cw-input-row button{flex-shrink:0;padding:10px 14px;border:none;border-radius:10px;background:var(--cw-brand);color:#fff;font-weight:700;cursor:pointer;font-size:14px}
.cw-input-row button:disabled,.cw-actions button:disabled{opacity:.55;cursor:not-allowed}
.cw-link{display:inline-block;margin-top:8px;color:var(--cw-brand);font-weight:700}
.cw-url{margin-top:4px;font-size:12px;line-height:1.5;color:var(--cw-muted);word-break:break-all}
.cw-extra{display:flex;flex-direction:column;align-items:stretch;gap:8px;margin-top:8px;width:100%}
.cw-postback{display:block;width:100%;box-sizing:border-box;margin:0;padding:10px 12px;border:1px solid var(--cw-brand);border-radius:10px;background:#fff;color:var(--cw-brand);font-weight:700;font-size:13px;line-height:1.45;text-align:left;cursor:pointer}
.cw-postback:hover{background:#ecfdf5}
.cw-extra .cw-link,.cw-extra .cw-url{align-self:flex-start}
.cw-form{flex-shrink:0;padding:12px;border-top:1px solid var(--cw-line);background:#fff;overflow-y:auto;max-height:45%}
.cw-form-title{font-weight:700;font-size:13px;margin-bottom:8px;color:#1f2937}
.cw-f-row{margin-bottom:10px}
.cw-f-row label{display:block;font-size:12px;color:var(--cw-muted);margin-bottom:4px}
.cw-req{color:#dc2626}
.cw-f-row input,.cw-f-row textarea{width:100%;box-sizing:border-box;padding:9px 10px;border:1px solid var(--cw-line);border-radius:8px;font-size:16px;font-family:inherit}
.cw-f-check{display:flex;align-items:center;gap:8px;font-size:13px;color:#1f2937;margin-bottom:10px;cursor:pointer}
.cw-f-check input{width:auto}
.cw-form-err{color:#dc2626;font-size:12px;min-height:16px;margin-bottom:6px}
.cw-form-actions{display:flex;gap:8px}
.cw-form-cancel{flex:0 0 auto;padding:9px 12px;border:1px solid var(--cw-line);border-radius:8px;background:#fff;cursor:pointer}
.cw-form-submit{flex:1;padding:9px 12px;border:none;border-radius:8px;background:var(--cw-brand);color:#fff;font-weight:700;cursor:pointer}
.cw-form-submit:disabled{opacity:.6;cursor:not-allowed}
body.chat-standalone{overflow:hidden;position:fixed;inset:0;width:100%;height:100dvh}
body.chat-standalone #chatWidgetRoot{right:0;bottom:0;left:0;top:0}
body.chat-standalone #chatWidgetBtn{display:none}
body.chat-standalone #chatWidgetPanel{display:flex;position:fixed;right:0;bottom:0;left:0;top:0;width:100%;height:100dvh;max-width:none;max-height:none;border-radius:0;border:none;box-shadow:none}
.chat-embed-inline #chatWidgetRoot{position:static;right:auto;bottom:auto;font-family:'Noto Sans JP',sans-serif}
.chat-embed-inline #chatWidgetBtn{display:none}
.chat-embed-inline #chatWidgetPanel{display:flex;position:static;width:100%;height:min(420px,55vh);max-height:420px;border-radius:12px;border:1px solid #c8d4ce;box-shadow:none}
.chat-embed-inline .cw-header{background:#13795b}
.chat-embed-inline .cw-input-row button,.chat-embed-inline .cw-form-submit{background:#13795b}
.chat-embed-inline .cw-postback{border-color:#13795b;color:#13795b}
.chat-embed-inline .cw-link{color:#13795b}
