/* Khung chat Trợ lý Tiệm Khóa Phương Trinh – build.py chép vào site/tro-ly/, gắn trên mọi trang (bản thật) */
.tpc{--n:#132F58;--n2:#0F2747;--v:#C99A3C;--v2:#B8862A;font-family:Inter,system-ui,sans-serif}
.tpc *{box-sizing:border-box}
.tpc-av{position:relative;flex:0 0 auto;width:42px;height:42px;border-radius:50%;background:#fff url(/anh/thuong-hieu/icon-192.png) center/78% no-repeat;box-shadow:0 0 0 2px var(--v)}
.tpc-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:#2fd36b;margin-right:6px;box-shadow:0 0 0 2px rgba(255,255,255,.9)}
/* Nút tròn nổi góc phải dưới */
.tpc-fab{position:fixed;right:18px;bottom:calc(18px + env(safe-area-inset-bottom,0px));z-index:40;width:62px;height:62px;border-radius:50%;border:3px solid var(--v);background:var(--n) url(/anh/thuong-hieu/icon-192.png) center/70% no-repeat;box-shadow:0 10px 28px rgba(15,39,71,.38);cursor:pointer;transition:transform .15s}
.tpc-fab:hover{transform:translateY(-2px)}
.tpc-fab::after{content:"";position:absolute;right:1px;top:1px;width:14px;height:14px;border-radius:50%;background:#2fd36b;border:2px solid #fff}
.tpc-fab:focus-visible,.tpc button:focus-visible,.tpc a:focus-visible{outline:3px solid var(--v);outline-offset:2px}
.tpc[data-open="1"] .tpc-fab,.tpc[data-open="1"] .tpc-chao{display:none}
.tpc-chao{position:fixed;right:18px;bottom:calc(92px + env(safe-area-inset-bottom,0px));z-index:40;max-width:290px;background:#fff;color:#1d2a3a;border:1px solid #DCE3EC;border-radius:16px 16px 4px 16px;padding:12px 34px 12px 14px;font-size:14px;line-height:1.5;box-shadow:0 12px 32px rgba(15,39,71,.18);cursor:pointer}
.tpc-chao[hidden]{display:none}
.tpc-chao strong{display:block;color:var(--n);margin-bottom:2px}
.tpc-chao-x{position:absolute;top:6px;right:6px;width:24px;height:24px;border:0;border-radius:50%;background:#EEF2F7;color:#5b6b80;font-size:12px;cursor:pointer}
/* Khung chat */
.tpc-box{position:fixed;right:18px;bottom:calc(18px + env(safe-area-inset-bottom,0px));z-index:41;width:400px;max-width:calc(100vw - 36px);height:min(640px,calc(100vh - 100px));background:#fff;border-radius:18px;border:1px solid #DCE3EC;box-shadow:0 24px 64px rgba(15,39,71,.32);display:flex;flex-direction:column;overflow:hidden}
.tpc-box[hidden]{display:none}
.tpc-head{display:flex;align-items:center;gap:12px;padding:14px 14px 14px 16px;background:linear-gradient(135deg,var(--n),var(--n2));color:#fff;border-bottom:3px solid var(--v)}
.tpc-ttl{flex:1;display:flex;flex-direction:column;line-height:1.35;min-width:0}
.tpc-ttl strong{font-size:15px;font-weight:700}
.tpc-ttl span{font-size:12.5px;color:#d7e3f3;display:flex;align-items:center}
.tpc-x{background:transparent;border:0;color:#fff;font-size:18px;cursor:pointer;padding:6px 8px;border-radius:8px}
.tpc-log{flex:1;overflow-y:auto;padding:14px;background:#F6F8FB;display:flex;flex-direction:column;gap:10px}
.tpc-m{max-width:86%;padding:10px 13px;border-radius:14px;font-size:15px;line-height:1.55;word-wrap:break-word}
.tpc-m.bot{background:#fff;border:1px solid #DCE3EC;align-self:flex-start;border-bottom-left-radius:4px;color:#1d2a3a}
.tpc-m.me{background:var(--n);color:#fff;align-self:flex-end;border-bottom-right-radius:4px}
.tpc-m a{color:var(--n);font-weight:600}.tpc-m.me a{color:#fff}
.tpc-m p{margin:0 0 6px}.tpc-m p:last-child{margin:0}
.tpc-go span{display:inline-block;width:7px;height:7px;margin:0 2px;border-radius:50%;background:#9aa8ba;animation:tpcb 1s infinite}
.tpc-go span:nth-child(2){animation-delay:.15s}.tpc-go span:nth-child(3){animation-delay:.3s}
@keyframes tpcb{0%,80%,100%{opacity:.3}40%{opacity:1}}
.tpc-nhanh{display:flex;gap:6px;flex-wrap:wrap;padding:8px 12px 0;background:#fff}
.tpc-nhanh[hidden]{display:none}
.tpc-nhanh button{border:1px solid #C9D3E0;background:#fff;border-radius:999px;padding:6px 11px;font-family:inherit;font-weight:500;font-size:13px;line-height:1.3;color:var(--n);cursor:pointer}
.tpc-nhanh button:hover{border-color:var(--v);background:#FBF6EC}
.tpc-form{display:flex;gap:8px;padding:10px 12px;background:#fff;border-top:1px solid #DCE3EC}
.tpc-form textarea{flex:1;resize:none;border:1px solid #C9D3E0;border-radius:12px;padding:10px 12px;font-family:inherit;font-size:15px;line-height:1.4;max-height:110px;outline:none;color:#1d2a3a}
.tpc-form textarea:focus{border-color:var(--n)}
.tpc-form button{width:46px;border:0;border-radius:12px;background:var(--n);color:#fff;font-size:18px;cursor:pointer}
.tpc-form button:disabled{opacity:.5}
.tpc-chan{display:flex;gap:8px;padding:0 12px 12px;background:#fff}
.tpc-chan a{flex:1;text-align:center;padding:10px 6px;border-radius:12px;font-weight:700;font-size:14px;white-space:nowrap;text-decoration:none}
.tpc-chan a.goi{background:var(--v);color:var(--n2)}
.tpc-chan a.goi:hover{background:var(--v2)}
.tpc-chan a.zalo{background:#fff;color:var(--n);border:2px solid var(--n)}
@media(max-width:720px){
  /* thanh gọi cố định của web cao ~72px: nút chat và khung chat nằm trên, không che */
  .tpc-fab{right:12px;bottom:calc(84px + env(safe-area-inset-bottom,0px));width:56px;height:56px}
  .tpc-chao{right:12px;left:12px;max-width:none;bottom:calc(150px + env(safe-area-inset-bottom,0px))}
  .tpc-box{left:6px;right:6px;top:6px;bottom:calc(78px + env(safe-area-inset-bottom,0px));width:auto;max-width:none;height:auto;border-radius:16px}
  .tpc-form textarea{font-size:16px}
}
@media(prefers-reduced-motion:reduce){.tpc-go span{animation:none}}
