.rag-widget{position:fixed;right:20px;bottom:20px;z-index:1200;font-family:"Noto Sans TC","Segoe UI",sans-serif;color:#173a33}
.rag-widget *{box-sizing:border-box}
.rag-widget button,.rag-widget textarea{font:inherit}
.rag-widget-launch{position:relative;display:grid;place-items:center;width:64px;height:64px;min-height:64px;padding:7px;border:1px solid #bce2cf;border-radius:50%;background:#237b5b;color:#fff;box-shadow:0 12px 32px rgba(14,70,48,.24);cursor:pointer;transition:transform .22s,box-shadow .22s,background .22s}
.rag-widget-launch:hover{background:#176849;box-shadow:0 16px 36px rgba(14,70,48,.3);transform:translateY(-2px)}
.rag-widget-launch:active{transform:scale(.94)}
.rag-widget-launch.is-open{background:#176849;box-shadow:0 10px 28px rgba(14,70,48,.32)}
.rag-widget-launch::after{position:absolute;inset:-5px;border:2px solid #5fbd8b;border-radius:50%;content:"";opacity:0;pointer-events:none}
.rag-widget-launch.is-open::after{animation:rag-widget-ring .42s ease-out}
.rag-widget-launch-icon,.rag-widget-avatar{display:grid;flex:none;place-items:center;width:38px;height:38px;border-radius:50%;background:#fff;color:#1b8158;font-size:22px;line-height:1}
.rag-widget-launch-icon{width:46px;height:46px;transition:transform .3s cubic-bezier(.2,.8,.2,1)}
.rag-widget-launch.is-open .rag-widget-launch-icon{transform:scale(1.08) rotate(-7deg)}
.rag-widget-launch-icon img,.rag-widget-avatar img{display:block;width:30px;height:30px;object-fit:contain}
.rag-widget-launch-icon img{width:38px;height:38px}
.rag-widget-panel{position:absolute;right:0;bottom:72px;display:flex;flex-direction:column;width:min(400px,calc(100vw - 24px));height:min(610px,calc(100dvh - 110px));min-height:310px;overflow:hidden;border:1px solid #d7e8de;border-radius:20px;background:#fff;box-shadow:0 22px 70px rgba(18,52,39,.24);opacity:0;visibility:hidden;pointer-events:none;transform:translateY(14px) scale(.96);transform-origin:bottom right;transition:opacity .24s ease,transform .3s cubic-bezier(.2,.8,.2,1),visibility .3s}
.rag-widget-panel.is-visible{opacity:1;visibility:visible;pointer-events:auto;transform:translateY(0) scale(1)}
.rag-widget-panel[hidden]{display:none}
.rag-widget-head{display:flex;align-items:center;gap:11px;padding:15px 16px;background:linear-gradient(125deg,#e8f6ed,#f8fcf9);border-bottom:1px solid #dceae2}
.rag-widget-avatar{width:42px;height:42px;background:#fff;border:1px solid #d7e8de;border-radius:13px}
.rag-widget-head-copy{flex:1;min-width:0}
.rag-widget-head-copy strong{font-size:16px;line-height:1.35}
.rag-widget-close{display:grid;flex:none;place-items:center;width:42px;height:42px;padding:0;border:0;border-radius:9px;background:transparent;color:#47665a;font-size:25px;line-height:1;cursor:pointer}
.rag-widget-close:hover{background:#dceee3}
.rag-widget-messages{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:18px 15px 8px;background:#fcfefd;scroll-behavior:smooth}
.rag-widget-welcome{max-width:300px;margin:22px auto;padding:20px;border:1px solid #e0eee5;border-radius:16px;background:#f1f8f3;text-align:center}
.rag-widget-welcome strong{font-size:17px}.rag-widget-welcome p{margin:8px 0 0;color:#627b6e;font-size:13px;line-height:1.6}
.rag-widget-message{display:flex;flex-direction:column;align-items:flex-start;max-width:90%;margin:0 0 14px;animation:rag-widget-message-in .28s ease-out both}
.rag-widget-message.user{align-items:flex-end;margin-left:auto}
.rag-widget-bubble{padding:10px 13px;border-radius:14px;background:#edf5f0;color:#173a33;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px}
.rag-widget-message.user .rag-widget-bubble{border-bottom-right-radius:4px;background:#237b5b;color:#fff}
.rag-widget-message.assistant .rag-widget-bubble{border-bottom-left-radius:4px}
.rag-widget-bubble.is-formatted{white-space:normal}
.rag-widget-bubble.is-formatted p,.rag-widget-bubble.is-formatted ul,.rag-widget-bubble.is-formatted ol,.rag-widget-bubble.is-formatted blockquote,.rag-widget-bubble.is-formatted pre{margin:0 0 9px}
.rag-widget-bubble.is-formatted :last-child{margin-bottom:0}
.rag-widget-bubble.is-formatted ul,.rag-widget-bubble.is-formatted ol{padding-left:20px}
.rag-widget-bubble.is-formatted li+li{margin-top:5px}
.rag-widget-bubble.is-formatted h3,.rag-widget-bubble.is-formatted h4,.rag-widget-bubble.is-formatted h5{margin:0 0 7px;color:#124936;font-size:1.05em;line-height:1.4}
.rag-widget-bubble.is-formatted strong{font-weight:700;color:#12583e}
.rag-widget-bubble.is-formatted blockquote{padding-left:10px;border-left:3px solid #a7d4b8;color:#526f60}
.rag-widget-bubble.is-formatted code{padding:1px 4px;border-radius:4px;background:#dceee3;font-size:.92em}
.rag-widget-bubble.is-formatted pre{max-width:100%;overflow-x:auto;padding:9px;border-radius:7px;background:#e4eee8}
.rag-widget-bubble.is-formatted pre code{padding:0;background:none}
.rag-widget-bubble.is-formatted a{color:#176b4b;text-decoration:underline;text-underline-offset:2px}
.rag-widget-bubble.is-formatted a.rag-widget-inline-contact{font-weight:700;text-decoration-thickness:1.5px}
.rag-widget-data-cards{display:grid;gap:8px;margin:9px 0 11px}
.rag-widget-data-card{min-width:0;padding:10px 11px;border:1px solid #d5e7dc;border-radius:11px;background:#fbfdfb}
.rag-widget-data-card-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:3px 8px;padding-bottom:6px;border-bottom:1px solid #e2eee6}
.rag-widget-data-card-head span{color:#627d6e;font-size:11px}
.rag-widget-data-card-head strong{font-size:14px}
.rag-widget-data-card dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 10px;margin:8px 0 0}
.rag-widget-data-card dl>div:first-child{grid-column:1/-1}
.rag-widget-data-card dt{color:#627d6e;font-size:11px;line-height:1.4}
.rag-widget-data-card dd{margin:2px 0 0;color:#173a33;font-size:13px;line-height:1.45;overflow-wrap:anywhere}
.rag-widget-message.is-pending .rag-widget-bubble{display:inline-flex;align-items:center;gap:7px;animation:rag-widget-search-sway 1.8s ease-in-out infinite}
.rag-widget-loading-dots{display:inline-flex;align-items:center;gap:3px;min-width:24px;height:1em}
.rag-widget-loading-dots i{display:block;width:5px;height:5px;border-radius:50%;background:#378a65;animation:rag-widget-dot 1.15s ease-in-out infinite}
.rag-widget-loading-dots i:nth-child(2){animation-delay:.16s}.rag-widget-loading-dots i:nth-child(3){animation-delay:.32s}
.rag-widget-sources{display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}
.rag-widget-sources a{max-width:100%;padding:6px 9px;border:1px solid #cce5d6;border-radius:9px;background:#f3faf5;color:#1a7352;text-decoration:none;font-size:12px;overflow-wrap:anywhere}
.rag-widget-sources a:hover{background:#e4f4e9}
.rag-widget-suggestions{display:flex;gap:6px;overflow-x:auto;padding:10px 14px;border-top:1px solid #edf2ee;scrollbar-width:thin}
.rag-widget-suggestions button{flex:none;min-height:38px;padding:8px 11px;border:1px solid #d0e6d8;border-radius:999px;background:#fff;color:#287554;font-size:12px;cursor:pointer}
.rag-widget-suggestions button:hover{background:#edf8f1}
.rag-widget-form{display:flex;align-items:end;gap:8px;margin:0 12px;padding:8px 8px 8px 12px;border:1px solid #c6ded0;border-radius:13px;background:#fff}
.rag-widget-form:focus-within{border-color:#c6ded0;box-shadow:none}
.rag-widget-form textarea{display:block;flex:1;min-width:0;min-height:32px;max-height:110px;padding:5px 0;resize:vertical;border:0;outline:0;background:transparent;color:#173a33;font-size:14px;line-height:1.45}
.rag-widget-form button{display:grid;flex:none;place-items:center;width:35px;height:35px;padding:0;border:0;border-radius:10px;background:#23885a;color:#fff;font-size:19px;cursor:pointer}
.rag-widget-form button:hover{background:#176b46}.rag-widget-form button:disabled{opacity:.55;cursor:wait}
.rag-widget-bottom{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 14px 12px;color:#73867b;font-size:11px;line-height:1.4}
.rag-widget-bottom span{min-width:0}.rag-widget-bottom a{flex:none;color:#227b58;font-weight:700;text-decoration:none}.rag-widget-bottom a:hover{text-decoration:underline}
.rag-widget button:focus-visible,.rag-widget a:focus-visible{outline:2px solid #50ab79;outline-offset:2px}
.rag-widget .visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@keyframes rag-widget-ring{0%{opacity:.85;transform:scale(.86)}100%{opacity:0;transform:scale(1.18)}}
@keyframes rag-widget-message-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@keyframes rag-widget-search-sway{0%,100%{transform:translateX(0)}50%{transform:translateX(3px)}}
@keyframes rag-widget-dot{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-4px);opacity:1}}
@media(prefers-reduced-motion:reduce){.rag-widget-launch,.rag-widget-launch-icon,.rag-widget-panel{transition:none}.rag-widget-launch.is-open::after,.rag-widget-message,.rag-widget-message.is-pending .rag-widget-bubble,.rag-widget-loading-dots i{animation:none}}
@media(max-width:520px){.rag-widget{right:12px;bottom:max(12px,env(safe-area-inset-bottom))}.rag-widget-panel{bottom:66px;height:min(640px,calc(100dvh - 90px));border-radius:18px}.rag-widget-launch{width:58px;height:58px;min-height:58px;padding:6px}.rag-widget-launch-icon{width:44px;height:44px}.rag-widget-launch-icon img{width:36px;height:36px}}
@media(max-width:360px){.rag-widget-suggestions{flex-wrap:wrap;overflow:visible}}
@media(max-height:500px){.rag-widget-panel{height:calc(100dvh - 85px);min-height:0}.rag-widget-welcome{margin:5px auto}.rag-widget-bottom{padding-bottom:7px}}
