/* TRIỀU DÂN visitor chat; isolated styles, no existing website selectors altered */
#tdChatWidget{font-family:Inter,"Segoe UI",Arial,sans-serif;color:#173451;font-size:13px;line-height:1.5;position:fixed;z-index:10010;right:22px;bottom:102px}
#tdChatWidget *{box-sizing:border-box}
#tdChatWidget .tdc-launch{display:flex;align-items:center;gap:8px;background:linear-gradient(135deg,#075fba,#073867);color:white;border:1px solid rgba(255,255,255,.3);padding:11px 16px;box-shadow:0 8px 30px rgba(5,48,90,.3);border-radius:0;cursor:pointer;font-weight:700}
#tdChatWidget .tdc-launch svg{height:21px;width:21px;fill:none;stroke:currentColor;stroke-width:1.9}
#tdChatWidget .tdc-panel[hidden]{display:none!important}
#tdChatWidget .tdc-panel{position:absolute;right:0;bottom:58px;width:min(376px,calc(100vw - 24px));height:min(585px,calc(100dvh - 128px));max-height:660px;display:flex;flex-direction:column;background:#fff;border:1px solid #c9dbe9;box-shadow:0 19px 66px rgba(4,38,71,.28);border-radius:0;overflow:hidden}
#tdChatWidget .tdc-head{padding:14px 16px;background:linear-gradient(125deg,#073765,#056aaa);color:#fff;display:flex;justify-content:space-between;align-items:center;gap:8px}
#tdChatWidget .tdc-brand b{display:block;font-size:14px;letter-spacing:.4px}#tdChatWidget .tdc-brand small{font-size:11px;color:#c8e6ff}
#tdChatWidget .tdc-close{color:white;background:transparent;border:0;cursor:pointer;font-size:26px;line-height:1;padding:3px 6px}
#tdChatWidget .tdc-note{font-size:11px;padding:8px 14px;background:#eff7fc;color:#41647f;border-bottom:1px solid #e1eaf1}
#tdChatWidget .tdc-feed{padding:14px 12px;overflow-y:auto;flex:1;display:flex;flex-direction:column;gap:10px;background:#f7fbfe}
#tdChatWidget .tdc-msg{max-width:90%;min-width:80px;padding:10px 12px;white-space:pre-wrap;overflow-wrap:anywhere;box-shadow:0 2px 6px rgba(0,0,0,.035);background:white;border:1px solid #e0eaf2;align-self:flex-start}
#tdChatWidget .tdc-msg.visitor{background:#dff0ff;border:1px solid #bdd9f2;align-self:flex-end}
#tdChatWidget .tdc-msg b{display:block;font-size:10px;color:#386d9c;margin-bottom:3px;text-transform:uppercase}#tdChatWidget .tdc-msg p{margin:0;line-height:1.55}
#tdChatWidget .tdc-time{display:block;font-size:10px;color:#7890a3;margin-top:4px;text-align:right}
#tdChatWidget .tdc-controls{padding:12px;background:white;border-top:1px solid #e0eaf2}
#tdChatWidget .tdc-name,#tdChatWidget .tdc-write{display:block;width:100%;border:1px solid #cbdae6;background:#fff;color:#183854;padding:8px 10px;border-radius:0;outline-color:#0d78c6;font-size:13px}
#tdChatWidget .tdc-name{margin-bottom:8px}#tdChatWidget .tdc-write{min-height:65px;max-height:96px;resize:vertical}
#tdChatWidget .tdc-actions{display:flex;align-items:center;justify-content:space-between;margin-top:7px;gap:8px}
#tdChatWidget .tdc-actions a{color:#075f9f;text-decoration:none;font-size:12px}
#tdChatWidget .tdc-send{padding:7px 16px;color:#fff;background:#0965ae;border:1px solid #0965ae;font-weight:700;cursor:pointer;border-radius:0}
#tdChatWidget .tdc-send:disabled{opacity:.5;cursor:wait}#tdChatWidget .tdc-alert{font-size:11px;color:#bb3d1f;padding-top:6px;min-height:16px}
@media(max-width:600px){#tdChatWidget{right:12px;bottom:89px}#tdChatWidget .tdc-panel{position:fixed;right:8px;left:8px;width:auto;bottom:150px;height:min(565px,calc(100dvh - 168px))}#tdChatWidget .tdc-launch{padding:11px 12px}}

#tdChatWidget .tdc-upload{display:flex;gap:8px;align-items:center;margin-top:6px;color:#53718d;font-size:11px}#tdChatWidget .tdc-pick{cursor:pointer;padding:4px 7px;background:#f0f7fc;border:1px solid #ccdeeb;color:#0b609d}#tdChatWidget .tdc-file-info{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#tdChatWidget .tdc-image{display:block;max-width:100%;max-height:260px;margin-top:5px;object-fit:contain;border:1px solid #ccdfeb}#tdChatWidget .tdc-msg p:empty{display:none}


/* TRIỀU DÂN · Chat UI refinement v1.9 — presentation only, API unchanged. */
#tdChatWidget{
  --td-ink:#123756;--td-primary:#0a568e;--td-accent:#127ac1;--td-line:#e1e9f0;
  --td-muted:#617b91;--td-canvas:#f5f8fb;right:20px;bottom:100px;
  color:var(--td-ink);font:13px/1.48 "Segoe UI",Inter,Arial,sans-serif;color-scheme:light;
}
#tdChatWidget .tdc-launch{
  min-height:43px;padding:8px 14px 8px 11px;gap:8px;
  border:1px solid #156ca8;border-radius:16px;
  background:linear-gradient(135deg,#06345b,#0a5f8f 55%,#0e7db2);color:#fff;
  font-size:12px;letter-spacing:.1px;font-weight:700;
  box-shadow:0 10px 24px rgba(6,49,84,.16);transition:box-shadow .2s ease,transform .2s ease;
}
#tdChatWidget .tdc-launch:hover{transform:translateY(-2px);box-shadow:0 13px 30px rgba(6,49,84,.28)}
#tdChatWidget .tdc-launch svg{width:20px;height:20px;flex-shrink:0}
#tdChatWidget .tdc-panel{
  width:min(334px,calc(100vw - 24px));height:min(462px,calc(100dvh - 198px));
  min-height:0;max-height:none;right:0;bottom:56px;
  border:1px solid #d9e5ee;border-radius:20px;background:#fff;
  box-shadow:0 16px 42px rgba(12,44,75,.15),0 2px 10px rgba(12,44,75,.06);
}
#tdChatWidget .tdc-head{
  flex-shrink:0;min-height:56px;padding:10px 12px 10px 13px;gap:8px;
  background:linear-gradient(135deg,#052f52 0%,#0a567f 58%,#0d6e9c 100%);border-bottom:1px solid rgba(255,255,255,.12)
}
#tdChatWidget .tdc-brand{display:flex;align-items:center;gap:10px;min-width:0}
#tdChatWidget .tdc-brand::before{content:none;display:none}
#tdChatWidget .tdc-brand-logo-wrap{display:grid;place-items:center;flex:0 0 34px;width:34px;height:34px;border-radius:10px;background:rgba(255,255,255,.16);border:1px solid rgba(255,255,255,.28);padding:4px;overflow:hidden;backdrop-filter:blur(3px)}
#tdChatWidget .tdc-brand-logo{display:block;max-width:24px;max-height:24px;width:auto;height:auto;object-fit:contain}
#tdChatWidget .tdc-brand b{font-size:12.5px;line-height:1.25;letter-spacing:.12px;color:#fff}
#tdChatWidget .tdc-brand small{font-size:10px;line-height:1.35;color:#d8ecf9}
#tdChatWidget .tdc-brand small::before{content:"";display:inline-block;width:6px;height:6px;background:#6ce7ad;border-radius:50%;margin-right:5px;vertical-align:1px;box-shadow:0 0 0 2px rgba(108,231,173,.13)}
#tdChatWidget .tdc-close{
  display:grid;place-items:center;flex:0 0 28px;width:28px;height:28px;padding:0;
  border-radius:9px;border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.08);
  font-size:22px;line-height:1;color:#fff;
}
#tdChatWidget .tdc-close:hover{background:rgba(255,255,255,.22)}
#tdChatWidget .tdc-note{flex-shrink:0;padding:8px 13px;font-size:10.7px;line-height:1.45;color:#526f88;background:#f0f6fa;border-bottom:1px solid var(--td-line)}
#tdChatWidget .tdc-feed{min-height:0;flex:1;padding:15px 12px 11px;gap:10px;background:linear-gradient(165deg,#f8fbfe,#f2f7fb);scrollbar-width:thin;scrollbar-color:#c8d8e6 transparent}
#tdChatWidget .tdc-msg{
  min-width:0;max-width:86%;padding:9px 12px;
  border:1px solid #e0eaf2;border-radius:18px 18px 18px 6px;
  box-shadow:0 2px 8px rgba(15,55,91,.03);background:#ffffff;color:#244660;
}
#tdChatWidget .tdc-msg.bot{max-width:94%;border-bottom-left-radius:10px}
#tdChatWidget .tdc-msg.visitor{border-radius:18px 18px 6px 18px;background:linear-gradient(180deg,#dff0fb,#d6eaf9);border-color:#bfdaf0;color:#123d5f}
#tdChatWidget .tdc-msg b{font-size:10px;letter-spacing:.15px;margin-bottom:4px;text-transform:none;color:#12699e}
#tdChatWidget .tdc-msg p{font-size:12.7px;line-height:1.55;margin:0}
#tdChatWidget .tdc-time{font-size:9.5px;color:#7f93a5;margin-top:5px}
#tdChatWidget .tdc-controls{flex-shrink:0;padding:11px 12px 9px;background:#fff;border-top:1px solid var(--td-line)}
#tdChatWidget .tdc-name,#tdChatWidget .tdc-write{
  border:1px solid #d5e2ec;border-radius:10px;background:#fbfdff;
  font:12.5px/1.45 "Segoe UI",Arial,sans-serif;padding:8px 10px;color:#1c405d;
  outline:0;transition:border-color .16s ease,box-shadow .16s ease
}
#tdChatWidget .tdc-name{height:35px;margin-bottom:7px}
#tdChatWidget .tdc-write{min-height:55px;height:55px;max-height:80px;resize:none;display:block}
#tdChatWidget .tdc-name::placeholder,#tdChatWidget .tdc-write::placeholder{color:#8598a8}
#tdChatWidget .tdc-name:focus,#tdChatWidget .tdc-write:focus{border-color:#3686b9;box-shadow:0 0 0 3px rgba(35,132,192,.13);background:#fff}
#tdChatWidget .tdc-upload{gap:7px;margin-top:7px;font-size:10.5px;color:#688297}
#tdChatWidget .tdc-pick{display:inline-flex;align-items:center;gap:3px;border-radius:7px;border:1px solid #dce8f1;background:#f5f9fc;padding:5px 8px;color:#276289;font-size:10.7px}
#tdChatWidget .tdc-pick:hover{background:#eaf4fc}
#tdChatWidget .tdc-actions{margin-top:8px;align-items:center;gap:7px}
#tdChatWidget .tdc-actions a{font-size:11px;font-weight:600;color:#156c9f}
#tdChatWidget .tdc-actions a:hover{text-decoration:underline}
#tdChatWidget .tdc-send{
  min-height:34px;padding:6px 12px;border:1px solid #075a92;border-radius:11px;
  color:#fff;background:linear-gradient(135deg,#06497c,#0a679d 60%,#0d7caf);
  font-size:11.5px;line-height:1.25;font-weight:700;box-shadow:0 3px 9px rgba(6,93,159,.16)
}
#tdChatWidget .tdc-send:hover:not(:disabled){background:linear-gradient(135deg,#053e6a,#085b8e 60%,#0b719d)}
#tdChatWidget .tdc-alert{min-height:0;padding-top:0;font-size:10.5px;line-height:1.4;overflow-wrap:anywhere}
#tdChatWidget .tdc-alert:not(:empty){padding-top:6px}
#tdChatWidget .tdc-image{border-radius:7px;max-height:180px;border:1px solid #dae6ef}
#tdChatWidget .tdc-launch:focus-visible,#tdChatWidget button:focus-visible,#tdChatWidget a:focus-visible,#tdChatWidget .tdc-pick:focus-within{outline:3px solid #67bff4;outline-offset:2px}
@media(max-width:600px){
  #tdChatWidget{right:12px;bottom:calc(88px + env(safe-area-inset-bottom))}
  #tdChatWidget .tdc-launch{width:48px;height:48px;min-height:48px;padding:0;justify-content:center;border-radius:18px}
  #tdChatWidget .tdc-launch span{display:none}
  #tdChatWidget .tdc-launch svg{width:23px;height:23px}
  #tdChatWidget .tdc-panel{
    position:fixed;left:auto;right:10px;width:min(334px,calc(100vw - 20px));
    bottom:calc(146px + env(safe-area-inset-bottom));
    height:min(470px,68dvh,calc(100dvh - 176px - env(safe-area-inset-bottom)));
    border-radius:14px
  }
  #tdChatWidget .tdc-note{font-size:10px}
}
@media(max-height:560px) and (min-width:601px){
  #tdChatWidget .tdc-panel{height:calc(100dvh - 110px);bottom:48px}
  #tdChatWidget{bottom:10px}
}
@media(prefers-reduced-motion:reduce){#tdChatWidget .tdc-launch,#tdChatWidget .tdc-name,#tdChatWidget .tdc-write{transition:none}}
@media print{#tdChatWidget{display:none!important}}

/* Header brand remains aligned on one column, even at narrow viewport sizes. */
#tdChatWidget .tdc-brand{
  flex:1;display:grid;grid-template-columns:35px minmax(0,1fr);
  grid-template-rows:auto auto;column-gap:10px;row-gap:2px;align-content:center
}
#tdChatWidget .tdc-brand::before{grid-column:1;grid-row:1/span 2}
#tdChatWidget .tdc-brand b{grid-column:2;grid-row:1;font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#tdChatWidget .tdc-brand small{grid-column:2;grid-row:2;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:10px}

/* TRIỀU DÂN chat v2.0 – one-time company contact registration. */
#tdChatWidget [hidden]{display:none!important}
#tdChatWidget .tdc-profilebar{
  padding:6px 12px 6px 14px;display:flex;gap:7px;align-items:center;justify-content:space-between;
  border-bottom:1px solid #dceaf2;background:#f7fbfe;color:#58748a;font-size:10.5px;min-height:30px;
}
#tdChatWidget .tdc-profiletext{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:600}
#tdChatWidget .tdc-edit{flex:none;padding:2px 7px;border:1px solid #c9e0ee;background:#fff;border-radius:6px;color:#126b9a;font-size:10px;cursor:pointer;font-weight:700}
#tdChatWidget .tdc-register{
  flex:1;min-height:0;overflow-y:auto;scrollbar-width:thin;padding:13px 20px 15px;
  background:linear-gradient(160deg,#fcfeff 0%,#f2f8fc 100%);color:#173d5a;
  display:flex;flex-direction:column;align-items:stretch;
}
#tdChatWidget .tdc-onboard-icon{
  width:52px;height:52px;flex:0 0 52px;display:grid;place-items:center;margin:2px auto 8px;
  border-radius:14px;background:rgba(255,255,255,.78);border:1px solid rgba(205,224,236,.95);padding:7px;
  box-shadow:0 6px 18px rgba(5,95,151,.08);backdrop-filter:blur(4px)
}
#tdChatWidget .tdc-onboard-logo{display:block;max-width:32px;max-height:32px;width:auto;height:auto;object-fit:contain}
#tdChatWidget .tdc-register h3{text-align:center;font-size:15px;line-height:1.35;margin:0 0 3px;font-weight:800;color:#123c5a}
#tdChatWidget .tdc-register p{font-size:11px;line-height:1.4;color:#678195;text-align:center;margin:0 0 10px}
#tdChatWidget .tdc-register label{font-weight:700;font-size:11px;color:#254f70;margin:5px 0 4px;line-height:1.3}
#tdChatWidget .tdc-register label em{color:#d54444;font-style:normal}
#tdChatWidget .tdc-register input{
  width:100%;height:35px;flex:0 0 35px;min-height:35px;background:white;color:#173d5a;
  border:1px solid #d3e3ee;border-radius:8px;padding:7px 10px;font:12px/1.4 "Segoe UI",Arial,sans-serif;
  box-shadow:0 1px 2px rgba(5,47,78,.02)
}
#tdChatWidget .tdc-register input:focus{outline:0;border-color:#1781bd;box-shadow:0 0 0 3px rgba(15,117,183,.12)}
#tdChatWidget .tdc-register input::placeholder{color:#8b9eac}
#tdChatWidget .tdc-register-btn{
  display:flex;align-items:center;justify-content:center;gap:9px;min-height:38px;flex:0 0 38px;
  padding:6px 14px;border:1px solid #096cab;border-radius:8px;margin-top:12px;
  color:#fff;background:linear-gradient(110deg,#075a94,#0b82bb);font-weight:750;font-size:12px;cursor:pointer;
  box-shadow:0 4px 12px rgba(10,101,160,.14)
}
#tdChatWidget .tdc-register-btn:disabled{opacity:.6;cursor:wait}
#tdChatWidget .tdc-register-btn span{font-size:16px;line-height:1}
#tdChatWidget .tdc-register small{display:block;font-size:9.5px;line-height:1.4;color:#7990a2;text-align:center;margin-top:10px}
#tdChatWidget .tdc-register-alert{font-size:10.5px;color:#b73929;line-height:1.35;overflow-wrap:anywhere}
#tdChatWidget .tdc-register-alert:not(:empty){margin-top:5px}
@media(max-width:600px){#tdChatWidget .tdc-register{padding:13px 16px 15px}}


/* TRIỀU DÂN Chat 2.6: mobile-first compact layout and accessible motion */
#tdChatWidget .tdc-panel{
  width:min(334px,calc(100vw - 24px));height:min(462px,calc(100dvh - 150px));
  overflow:hidden;transform-origin:right bottom;will-change:transform,opacity;
}
#tdChatWidget .tdc-feed{padding:9px 10px 8px;gap:7px;overscroll-behavior:contain}
#tdChatWidget .tdc-note{padding:6px 11px;line-height:1.35}
#tdChatWidget .tdc-controls{padding:9px 10px 8px}
#tdChatWidget .tdc-register{padding:11px 15px 12px}
#tdChatWidget .tdc-msg{padding:8px 11px}
#tdChatWidget .tdc-write{min-height:49px;height:49px;max-height:74px;border-radius:14px;
  background:linear-gradient(180deg,#fff,#f9fcff);
  border:1px solid #d2e1ec;box-shadow:inset 0 1px 2px rgba(9,56,92,.04)}
#tdChatWidget .tdc-write:focus{border-color:#2780b3;box-shadow:0 0 0 3px rgba(29,133,188,.12)}
#tdChatWidget .tdc-actions{margin-top:6px}
#tdChatWidget .tdc-upload{margin-top:6px}
#tdChatWidget .tdc-launch,#tdChatWidget .tdc-send{transition:transform .2s ease,box-shadow .2s ease,background .2s ease}
#tdChatWidget .tdc-launch:active,#tdChatWidget .tdc-send:active:not(:disabled){transform:translateY(0) scale(.97)}
@media(max-width:600px){
  #tdChatWidget{right:12px;bottom:calc(84px + env(safe-area-inset-bottom))}
  #tdChatWidget .tdc-launch{min-width:49px;width:49px;min-height:49px;height:49px;border-radius:17px}
  #tdChatWidget .tdc-panel{
    position:fixed;left:8px;right:8px;width:auto;
    bottom:calc(140px + env(safe-area-inset-bottom));
    height:min(540px,74dvh,calc(100dvh - 155px - env(safe-area-inset-bottom)));
    border-radius:19px;transform-origin:right bottom;
  }
  #tdChatWidget .tdc-head{min-height:54px;padding:9px 11px}
  #tdChatWidget .tdc-feed{padding:9px 9px 7px;gap:7px}
  #tdChatWidget .tdc-register{padding:10px 14px 12px}
  #tdChatWidget .tdc-controls{padding:8px 9px 8px}
  #tdChatWidget .tdc-write{font-size:16px} /* prevents auto-zoom on iOS */
  #tdChatWidget .tdc-register input{font-size:16px}
  #tdChatWidget .tdc-send{min-height:38px}
}
@media(max-width:600px) and (max-height:560px){
  #tdChatWidget .tdc-panel{left:7px;right:7px;bottom:8px;width:auto;height:calc(100dvh - 16px);max-height:none}
  #tdChatWidget .tdc-head{min-height:48px}
  #tdChatWidget .tdc-note{display:none}
  #tdChatWidget .tdc-onboard-icon{display:none}
  #tdChatWidget .tdc-register p{margin-bottom:4px}
}
@media(prefers-reduced-motion:reduce){
  #tdChatWidget .tdc-launch,#tdChatWidget .tdc-send,#tdChatWidget .tdc-panel{transition:none!important;animation:none!important;will-change:auto}
}

/* TRIỀU DÂN v2.6.1: keep mobile registration compact and logo centered. */
#tdChatWidget .tdc-brand-logo-wrap{border-radius:10px;flex:0 0 36px;width:36px;height:36px;padding:3px;background:rgba(255,255,255,.90)}
#tdChatWidget .tdc-brand-logo{width:100%;height:100%;max-width:none;max-height:none;object-fit:contain}
#tdChatWidget .tdc-onboard-icon{background:rgba(255,255,255,.86);padding:5px}
#tdChatWidget .tdc-onboard-logo{width:100%;height:100%;max-width:none;max-height:none;object-fit:contain}
/* Desktop compact registration, without a needless scrollbar. */
#tdChatWidget .tdc-register{padding:10px 15px}
#tdChatWidget .tdc-onboard-icon{width:48px;height:48px;flex:0 0 48px;margin:0 auto 6px}
#tdChatWidget .tdc-register p{margin-bottom:6px}
#tdChatWidget .tdc-register label{margin:4px 0 3px}
#tdChatWidget .tdc-register-btn{margin-top:8px}
#tdChatWidget .tdc-register small{margin-top:7px}
@media(max-width:600px) and (max-height:700px){
  #tdChatWidget .tdc-note{display:none}
  #tdChatWidget .tdc-register{padding:8px 13px 9px;scrollbar-width:none}
  #tdChatWidget .tdc-register::-webkit-scrollbar{width:0}
  #tdChatWidget .tdc-onboard-icon{height:43px;width:52px;flex:0 0 43px;margin:0 auto 4px;padding:5px}
  #tdChatWidget .tdc-register h3{font-size:15px;line-height:1.23;margin:0 0 2px}
  #tdChatWidget .tdc-register p{font-size:10.6px;line-height:1.35;margin:0 0 4px}
  #tdChatWidget .tdc-register label{font-size:11px;margin:3px 0 2px;line-height:1.25}
  #tdChatWidget .tdc-register input{height:40px;min-height:40px;flex:0 0 40px;padding:6px 10px}
  #tdChatWidget .tdc-register-btn{min-height:39px;flex:0 0 39px;margin-top:7px}
  #tdChatWidget .tdc-register small{font-size:9px;margin-top:5px}
}
@media(max-width:600px) and (max-height:460px){
  #tdChatWidget .tdc-onboard-icon{display:none}
  #tdChatWidget .tdc-register p{display:none}
}
