/* Cửa sổ chat nổi "Trợ lý AI Phòng tuyến số" (mọi trang công khai trừ /tro-ly-ai) + nút gọi chiến sĩ + nút Ping khẩn cấp.
   Markup: resources/views/layouts/partials/site-fab.blade.php — hành vi: public/js/chat-widget.js.
   1em = cỡ chữ gốc của cụm (16px; 14px khi màn hình < 1200px). */
.cw{font-size:16px;font-family:inherit;color:#10265f}
.cw *,.cw *:before,.cw *:after{box-sizing:border-box}
.cw button,.cw input{font-family:inherit;font-size:inherit}
.cw svg.i{width:1em;height:1em;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;flex:none;display:block}
@media (max-width:1199.98px){.cw{font-size:14px}}

/* ---------- cụm nút góc phải dưới ---------- */
.cw-dock{position:fixed;right:1.4em;bottom:1.4em;z-index:45;display:flex;flex-direction:column;align-items:flex-end;gap:.7em;transition:right .3s ease}
.cw-launch{display:flex;align-items:flex-end;text-decoration:none;font-size:.58em;transition:font-size .3s ease}
.cw-bubble{position:relative;margin-right:-.2em;margin-bottom:2em;padding:.95em 1.3em;border-radius:1.4em;color:#fff;font-weight:700;font-size:1.35em;line-height:1.3;white-space:nowrap;
  background:linear-gradient(135deg,#0b3aa6,#1255cf);border:.09em solid rgba(110,180,255,.7);box-shadow:0 0 1.2em rgba(40,130,255,.45),0 .6em 1.6em rgba(5,30,110,.35)}
.cw-bubble:after{content:"";position:absolute;right:-.15em;bottom:-.9em;width:1.8em;height:1.4em;background:#1255cf;clip-path:polygon(0 0,100% 0,60% 100%)}
.cw-avb{position:relative;display:block;flex:none;width:9.4em;height:9.4em;border-radius:50%;
  background:radial-gradient(circle at 50% 30%,#fff 0,#d7e9fd 75%);box-shadow:0 0 0 .5em #0b2a7a,0 0 0 .8em rgba(255,255,255,.9),0 1em 2em rgba(5,30,110,.45);transition:transform .2s}
.cw-avb .clip{position:absolute;inset:0;border-radius:50%;overflow:hidden}
.cw-avb img{position:absolute;width:150%;max-width:none;height:auto;left:-25%;top:4%}
.cw-avb .dot{position:absolute;right:.2em;bottom:.6em;width:2em;height:2em;border-radius:50%;background:#22c55e;border:.28em solid #fff;box-shadow:0 .2em .6em rgba(0,0,0,.3)}
.cw-avb:before{content:"";position:absolute;inset:-.5em;border-radius:50%;border:.2em solid rgba(61,160,255,.7);animation:cw-ping 2.6s cubic-bezier(0,0,.2,1) infinite}
@keyframes cw-ping{0%{transform:scale(1);opacity:.8}100%{transform:scale(1.45);opacity:0}}
.cw-spark{position:absolute;right:-2.2em;top:-1.8em;width:3.6em;height:3em;color:#2f8cff}
.cw-launch:hover .cw-avb,.cw-launch:focus-visible .cw-avb{transform:translateY(-.3em)}
.cw-launch:focus-visible{outline:3px solid #3ad0ff;outline-offset:6px;border-radius:14px}
.cw.is-open .cw-launch{font-size:1em}
.cw.is-open .cw-avb:before{animation:none;opacity:0}
/* cửa sổ mở: nút gọi + Ping lùi sang trái cửa sổ (như thiết kế); màn hình hẹp thì ẩn hẳn */
.cw.is-open .cw-dock{right:calc(1.4em + 33em + 3em)}
@media (max-width:1099.98px){.cw.is-open .cw-dock{display:none}}

/* ---------- cửa sổ chat ---------- */
.cw-panel{position:fixed;right:1.4em;bottom:1.4em;z-index:60;width:min(33em,calc(100vw - 2.8em));height:min(46em,calc(100vh - 5.5em));height:min(46em,calc(100dvh - 5.5em));
  display:flex;flex-direction:column;border-radius:2em;overflow:hidden;background:linear-gradient(180deg,#dcebfc 0,#eef6ff 100%);
  box-shadow:0 1.5em 4em rgba(10,40,120,.38),0 0 0 .1em rgba(255,255,255,.7);transform-origin:100% 100%;animation:cw-in .22s ease-out}
.cw-panel[hidden]{display:none}
@keyframes cw-in{from{opacity:0;transform:scale(.94) translateY(1em)}to{opacity:1;transform:none}}
.cw-hd{flex:none;position:relative;z-index:3;display:flex;align-items:center;gap:.9em;height:8.4em;padding:1.4em 1.3em 1.3em 1.3em;color:#fff;
  background:radial-gradient(120% 140% at 85% 0,#1f62d6 0,rgba(31,98,214,0) 55%),linear-gradient(100deg,#0a2f8f 0,#0d44b8 60%,#1558cf 100%)}
.cw-hd:before{content:"";position:absolute;inset:0;pointer-events:none;background:
  radial-gradient(circle at 16% 40%,rgba(120,180,255,.28) 0,transparent 28%),
  repeating-linear-gradient(115deg,rgba(255,255,255,.04) 0 .12em,transparent .12em 1.4em)}
.cw-hd__wave{position:absolute;left:0;right:0;bottom:-.1em;width:100%;height:2em;pointer-events:none}
.cw-logo{position:relative;flex:none;width:4.8em;height:4.8em;border-radius:50%;overflow:hidden;background:#123f9d;
  box-shadow:0 0 0 .2em rgba(255,255,255,.95),0 0 0 .4em rgba(160,205,255,.4),0 .4em 1.2em rgba(0,20,80,.45)}
.cw-logo img{display:block;width:100%;height:100%;object-fit:cover}
.cw-tt{position:relative;min-width:0;flex:1}
.cw-tt h2{margin:0;font-size:1.4em;line-height:1.18;font-weight:800;letter-spacing:.005em;text-transform:uppercase;text-shadow:0 .1em .4em rgba(0,20,80,.35)}
.cw-on{display:inline-flex;align-items:center;gap:.5em;margin-top:.5em;min-height:1.9em;padding:0 .9em;border-radius:99px;background:rgba(4,28,92,.55);border:.05em solid rgba(255,255,255,.14);font-size:.85em;font-weight:600;white-space:nowrap}
.cw-on i{width:.7em;height:.7em;border-radius:50%;background:#22c55e;box-shadow:0 0 .6em #22c55e;animation:cw-p 2s infinite}
.cw-on b{color:#4ade80;font-weight:700}
@keyframes cw-p{50%{opacity:.55}}
.cw-hb{position:relative;display:flex;align-items:center;gap:.5em;flex:none}
.cw-ic{display:grid;place-items:center;width:2.8em;height:2.8em;min-width:44px;min-height:44px;padding:0;border-radius:50%;border:.06em solid rgba(255,255,255,.28);background:rgba(255,255,255,.13);color:#fff;cursor:pointer;transition:background .15s}
.cw-ic svg.i{width:1.45em;height:1.45em;stroke-width:2.1}
.cw-ic:hover,.cw-ic:focus-visible{background:rgba(255,255,255,.28)}
.cw-ic:focus-visible{outline:2px solid #3ad0ff;outline-offset:2px}
.cw-ic:disabled{opacity:.6;cursor:wait}

.cw-main{flex:1 1 0;min-height:0;position:relative}
.cw-deco{position:absolute;right:-1.5em;top:11em;width:9em;color:#bcd5f2;pointer-events:none}
.cw-deco2{position:absolute;right:2em;top:24em;width:3.2em;color:#d3e3f6;pointer-events:none}
.cw-msgs{position:absolute;inset:0;overflow-y:auto;padding:1.2em 1.3em 1em 1.1em}
.cw-row{display:flex;align-items:flex-start;gap:.7em;margin-bottom:1.05em}
.cw-av{flex:none;position:relative;width:3.6em;height:3.6em;border-radius:50%;overflow:hidden;background:radial-gradient(circle at 50% 30%,#fff 0,#d9eafd 75%);box-shadow:0 0 0 .12em #fff,0 0 0 .22em #bddcfd,0 .2em .6em rgba(40,120,220,.25)}
.cw-av img{position:absolute;width:158%;max-width:none;height:auto;left:-29%;top:3%}
.cw-col{min-width:0;max-width:calc(100% - 4.3em)}
.cw-bub{background:#fff;border-radius:1.3em;padding:.95em 1.05em;max-width:18.5em;font-size:1em;line-height:1.38;color:#1f2937;box-shadow:0 .3em 1em rgba(30,90,170,.1);overflow-wrap:anywhere}
.cw-bub strong{color:#0d2a6b}
.cw-bub ul{margin:.3em 0;padding-left:1.2em;list-style:disc}
.cw-bub li{margin:.15em 0}
.cw-src{margin-top:.7em;padding-top:.5em;border-top:.06em solid #e6eef8;font-size:.82em;color:#475569}
.cw-src__t{margin-bottom:.25em;font-weight:700}
.cw-src ul{margin:0;padding:0;list-style:none}
.cw-src li{margin:.15em 0}
.cw-t{display:flex;align-items:center;gap:.7em;margin:.4em 0 0 .3em;font-size:.82em;color:#6b7a94}
.cw-t button{display:inline-grid;place-items:center;min-width:44px;min-height:44px;margin:-.9em 0;padding:0;border:0;background:none;color:#3b7fd6;cursor:pointer}
.cw-t button svg.i{width:1.4em;height:1.4em}
.cw-t button[hidden]{display:none}
.cw-row--u{justify-content:flex-end}
.cw-row--u .cw-col{display:flex;flex-direction:column;align-items:flex-end}
.cw-row--u .cw-bub{background:linear-gradient(90deg,#1f8bf3,#0b66d6);color:#fff;border-top-right-radius:.5em;box-shadow:0 .35em 1em rgba(10,100,220,.3)}
.cw-row--err .cw-av{background:#dc2626;display:grid;place-items:center;color:#fff;font-weight:800;font-size:1.3em;box-shadow:none}
.cw-row--err .cw-bub{background:#fef2f2;border:.07em solid #fca5a5;color:#7f1d1d}
.cw-risk{display:inline-block;max-width:100%;margin-bottom:.45em;padding:.3em .8em;border-radius:.8em;font-size:.78em;font-weight:700}
.cw-risk--emergency{color:#7f1d1d;background:#fee2e2;border:.07em solid #fca5a5}
.cw-risk--high{color:#7c2d12;background:#ffedd5;border:.07em solid #fdba74}
.cw-risk--warning{color:#78350f;background:#fef3c7;border:.07em solid #fcd34d}
.cw-sh{margin:1.1em 0 .65em .3em;font-size:.88em;font-weight:700;letter-spacing:.07em;color:#5a6f93;text-transform:uppercase}
.cw-q{display:flex;flex-direction:column;align-items:flex-start;gap:.5em}
.cw-pill{display:inline-flex;align-items:center;gap:.8em;min-height:44px;max-width:100%;padding:.35em 1.15em .35em .95em;background:#fff;border:.075em solid #d4e3f4;border-radius:99px;font-size:.95em;font-weight:500;line-height:1.3;color:#0f4c3a;cursor:pointer;text-align:left;
  box-shadow:0 .15em .5em rgba(30,90,170,.05);transition:border-color .15s,transform .15s}
.cw-pill svg.i{width:1.35em;height:1.35em;color:#f2a516;stroke-width:2.4}
.cw-pill:hover,.cw-pill:focus-visible{border-color:#f2a516;transform:translateX(.15em)}
.cw-pill:focus-visible,.cw-ib:focus-visible{outline:2px solid #1b72d8;outline-offset:2px}
.cw-typing{display:inline-flex;align-items:center;gap:.35em;min-height:1.4em}
.cw-typing i{width:.6em;height:.6em;border-radius:50%;background:#3b82f6;animation:cw-b 1s infinite}
.cw-typing i:nth-child(2){animation-delay:.15s}.cw-typing i:nth-child(3){animation-delay:.3s}
.cw-typing span{margin-left:.5em;font-size:.9em;color:#475569}
@keyframes cw-b{0%,80%,100%{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-.25em)}}

.cw-ft{flex:none;padding:.8em 1.1em 1.2em;background:linear-gradient(180deg,rgba(238,246,255,0),#e9f3fe 30%)}
.cw-fld{display:flex;align-items:center;gap:.5em;min-height:4.2em;padding:.25em .5em .25em 1em;background:#fff;border:.16em solid #66a8f0;border-radius:99px;box-shadow:0 0 0 .22em rgba(255,255,255,.9),0 .3em 1em rgba(27,114,216,.18)}
.cw-fld:focus-within{border-color:#1b72d8}
.cw-fld input{flex:1;min-width:0;border:0;outline:0;background:transparent;font-size:max(16px,1.05em);color:#10265f;padding:.3em .2em}
.cw-fld input::placeholder{color:#8a97ad}
.cw-ib{display:inline-grid;place-items:center;flex:none;width:2.6em;height:2.6em;min-width:44px;min-height:44px;margin:-.2em 0;padding:0;border:0;background:none;color:#2a73d6;border-radius:50%;cursor:pointer;text-decoration:none}
.cw-ib svg.i{width:1.5em;height:1.5em}
.cw-ib:hover,.cw-ib:focus-visible{background:#eaf3fe}
.cw-ib[hidden]{display:none}
.cw-ib.is-on{background:#fee2e2;color:#dc2626;animation:cw-p 1s infinite}
.cw-snd{display:grid;place-items:center;flex:none;width:3.3em;height:3.3em;min-width:44px;min-height:44px;padding:0;border-radius:50%;border:0;background:radial-gradient(circle at 35% 25%,#3da0ff 0,#0f6fe0 55%,#0a58c7 100%);color:#fff;cursor:pointer;box-shadow:0 .3em .8em rgba(10,95,208,.45)}
.cw-snd svg.i{width:1.5em;height:1.5em;stroke-width:1.8}
.cw-snd:disabled{background:#c9d6e8;box-shadow:none;cursor:not-allowed}

/* ---------- điện thoại: cửa sổ toàn màn hình, nút gọn ---------- */
.cw-lock{overflow:hidden}
@media (max-width:699.98px){
  .cw-dock{right:.7em;bottom:68px;gap:.9em}
  .cw-launch{font-size:.45em}
  .cw-bubble{display:none}
  .cw-spark{display:none}
  .cw-panel{right:0;bottom:0;left:0;top:0;width:100%;height:100vh;height:100dvh;border-radius:0;box-shadow:none}
  .cw-hd{height:7.2em;padding:1em}
  .cw-logo{width:3.7em;height:3.7em}
  .cw-tt h2{font-size:.92em}
  .cw-hb{gap:.35em}
  .cw-on__sub{display:none}
  .cw-msgs{padding:1em .9em .8em .8em}
  .cw-bub{max-width:100%}
}
@media (prefers-reduced-motion:reduce){.cw *{animation:none!important;transition:none!important}}

.cw-msgs{overscroll-behavior:contain}

/* Thu nhỏ cụm bong bóng chat + Ping khẩn cấp xuống 80% (neo ở góc phải-dưới nên vị trí không đổi) */
.cw-dock{transform:scale(.8);transform-origin:100% 100%}
