/* Tro ly chat: nut mo (trong cum Lien he) + khung chat. Dung mau/chu/bo goc cua web (--brand, --dark, --line...). Nap sau, khong nam o phan hien dau trang. */
.chat-fab{display:none}
@media (min-width:761px){
    .chat-fab{position:fixed;right:14px;bottom:84px;z-index:9000;display:flex;align-items:center;gap:8px;height:48px;width:48px;padding:0;justify-content:center;border-radius:999px;background:var(--brand,#d51f2b);color:#fff;font-weight:700;font-size:14px;text-decoration:none;box-shadow:0 8px 20px rgba(213,31,43,.35);transition:opacity .2s ease,transform .2s ease}
    .chat-fab span{display:none}
    .chat-fab:hover{background:var(--brand-dark,#a91620)}
    .fab-tucked .chat-fab{opacity:0;transform:scale(.8);pointer-events:none}
}
@media (max-width:760px){
    .chat-fab{display:inline-flex}
    body .fab-hub .fab-hub-list a.chat-fab{background:var(--brand,#d51f2b)}
}
body.cart-checkout-page .chat-fab,body.public-estimate-page .chat-fab{display:none !important}

.nvchat{position:fixed;z-index:9600;right:14px;bottom:14px;width:370px;max-width:calc(100vw - 28px);height:min(560px,calc(100dvh - 28px));display:none;flex-direction:column;background:var(--bg,#fff);color:var(--text,#17191c);border:1px solid var(--line,#e3e6e8);border-radius:var(--radius,14px);box-shadow:0 18px 50px rgba(20,25,30,.28);overflow:hidden;font-family:var(--font-body,Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif);font-size:15px;line-height:1.5}
.nvchat.is-open{display:flex}
.nvchat-head{display:flex;align-items:center;gap:10px;padding:12px 14px;background:var(--dark,#111315);color:#fff;border-bottom:3px solid var(--brand,#d51f2b)}
.nvchat-head strong{flex:1;font-family:var(--font-display,inherit);font-size:15px;font-weight:800;letter-spacing:.01em}
.nvchat-head small{display:block;font-weight:500;font-size:12px;color:#b9bec4;letter-spacing:0}
.nvchat-close{border:0;background:rgba(255,255,255,.12);color:#fff;width:34px;height:34px;border-radius:50%;font-size:20px;line-height:1;cursor:pointer}
.nvchat-close:hover{background:rgba(255,255,255,.22)}
.nvchat-log{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:8px;background:var(--surface,#f6f7f8);overscroll-behavior:contain}
.nvchat-msg{max-width:88%;padding:9px 12px;border-radius:12px;white-space:pre-wrap;word-break:break-word}
.nvchat-msg.is-bot{align-self:flex-start;background:var(--bg,#fff);border:1px solid var(--line,#e3e6e8);border-bottom-left-radius:4px}
.nvchat-msg.is-user{align-self:flex-end;background:var(--brand,#d51f2b);color:#fff;border-bottom-right-radius:4px}
.nvchat-msg a{color:var(--brand,#d51f2b);font-weight:650;text-decoration:underline;word-break:break-all}
.nvchat-msg.is-user a{color:#fff}
.nvchat-note{font-size:12px;color:var(--muted,#6c737c);padding:0 12px 6px;background:var(--surface,#f6f7f8)}
.nvchat-chips{display:flex;flex-wrap:wrap;gap:6px}
.nvchat-chips button{border:1px solid var(--line,#e3e6e8);background:var(--bg,#fff);color:var(--text,#17191c);border-radius:999px;padding:6px 12px;font:inherit;font-size:13px;font-weight:650;cursor:pointer}
.nvchat-chips button:hover{border-color:var(--brand,#d51f2b);color:var(--brand,#d51f2b)}
.nvchat-typing{align-self:flex-start;color:var(--muted,#6c737c);font-size:13px;padding:2px 6px}
.nvchat-help{display:flex;gap:14px;padding:6px 12px;background:var(--surface,#f6f7f8);border-top:1px solid var(--line,#e3e6e8);font-size:13px}
.nvchat-help a{color:var(--text,#17191c);font-weight:650;text-decoration:underline}
.nvchat-form{display:flex;gap:8px;padding:10px;border-top:1px solid var(--line,#e3e6e8);background:var(--bg,#fff)}
.nvchat-form input{flex:1;min-width:0;border:1px solid var(--line,#e3e6e8);border-radius:10px;padding:0 12px;height:42px;font:inherit;font-size:16px;color:inherit;background:var(--bg,#fff)}
.nvchat-form input:focus{outline:2px solid var(--brand,#d51f2b);outline-offset:-1px;border-color:var(--brand,#d51f2b)}
.nvchat-form button{border:0;border-radius:10px;background:var(--brand,#d51f2b);color:#fff;font:inherit;font-weight:800;padding:0 18px;height:42px;cursor:pointer}
.nvchat-form button:hover:not(:disabled){background:var(--brand-dark,#a91620)}
.nvchat-form button:disabled{opacity:.55;cursor:default}
html.nvchat-lock,html.nvchat-lock body{overflow:hidden;overscroll-behavior:none}
@media (max-width:760px){
    .nvchat{inset:0;width:auto;max-width:none;height:100dvh;border:0;border-radius:0}
    .nvchat-head{padding:12px 14px;padding-top:max(12px,env(safe-area-inset-top))}
    .nvchat-close{width:42px;height:42px;font-size:24px}
    .nvchat-log{padding:14px 12px;gap:10px}
    .nvchat-msg{max-width:92%;font-size:16px}
    .nvchat-chips button{min-height:42px;padding:8px 14px;font-size:14px}
    .nvchat-note{font-size:12px;line-height:1.35}
    .nvchat-help{gap:0;padding:0;font-size:14px}
    .nvchat-help a{flex:1;text-align:center;text-decoration:none;padding:11px 8px;font-weight:750}
    .nvchat-help a+a{border-left:1px solid var(--line,#e3e6e8)}
    .nvchat-form{padding:10px 10px calc(10px + env(safe-area-inset-bottom));gap:8px}
    .nvchat-form input{height:46px;font-size:16px}
    .nvchat-form button{height:46px;min-width:68px}
}
@media (prefers-reduced-motion:no-preference){
    .nvchat.is-open{animation:nvchat-in .18s ease-out}
    @keyframes nvchat-in{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
}
