
.tnw-chat-floating { position: fixed; right: 14px; bottom: 14px; z-index: 999999; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.tnw-bubble { width: 56px; height: 56px; border-radius: 9999px; border: 0; box-shadow: 0 10px 24px rgba(0,0,0,.22); cursor: pointer; display:flex; align-items:center; justify-content:center; color:#fff; background:#e11d48; transition: transform .2s ease, box-shadow .2s ease; position: relative; }
.tnw-bubble:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,0,0,.28); }
.tnw-icon { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }
.tnw-icon-close { display:none; font-size:28px; line-height:1; }
.tnw-open .tnw-icon-chat { display:none; }
.tnw-open .tnw-icon-close { display:flex; }
.tnw-panel { position: fixed; right: 14px; bottom: 86px; width: 360px; max-height: 72vh; background: #fff; border-radius: 16px; overflow: hidden; border:1px solid #f1f1f1; box-shadow: 0 22px 48px rgba(0,0,0,.25); transform-origin: bottom right; }
.tnw-open .tnw-panel { bottom: 120px; } /* đẩy hộp thư cao lên khi mở */
.tnw-header { position: sticky; top:0; display:flex; align-items:center; gap:8px; background: linear-gradient(90deg,#ef4444,#b91c1c); color:#fff; padding: 12px 14px; font-weight: 700; }
.tnw-title { flex:1; }
.tnw-status { font-size:12px; padding:2px 8px; border-radius:999px; background:rgba(255,255,255,.2); }
.tnw-status.on { background:#16a34a; color:#fff; }
.tnw-status.off { background:#9ca3af; color:#111; }
.tnw-close { margin-left:auto; background: transparent; color: #fff; border: 0; font-size: 22px; cursor: pointer; }
.tnw-prechat { padding:12px; display:flex; flex-direction:column; gap:8px; border-bottom:1px solid #f1f1f1; }
.tnw-pre-title { font-weight:700; }
.tnw-pre-row input { width:100%; padding:12px 14px; border:1px solid #e5e7eb; border-radius:12px; background:#fff; }
.tnw-pre-btn { padding:12px 16px; border:0; border-radius:12px; background:#111; color:#fff; cursor:pointer; }
.tnw-body { padding: 12px; background:#fff; overflow-y: auto; display:flex; flex-direction: column; gap: 10px; }
.tnw-msg { padding: 10px 12px; max-width: 78%; border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.06); font-size: 14px; line-height: 1.45; }
.tnw-msg.user { align-self: flex-end; background: #ffe69b; }
.tnw-msg.agent { align-self: flex-start; background: #f4f5f6; }
.tnw-input { display:flex; gap: 8px; padding: 10px; border-top: 1px solid #eee; background:#fff; }
.tnw-input input { flex:1; padding: 12px 14px; border: 1px solid #ddd; border-radius: 12px; }
.tnw-input button { padding: 12px 16px; border: 0; border-radius: 12px; background:#111; color:#fff; cursor:pointer; }
.tnw-offline-note { font-size:12px; color:#555; padding:6px 10px 12px; }
@media (max-width: 480px){ .tnw-panel { width: calc(100vw - 20px); right: 10px; } }
/* ===== 1) Nút đóng (❌) trên header: căn giữa, khoảng cách đều ===== */
.tnw-header{
  padding: 12px 12px;           /* đều 2 bên */
}
.tnw-close{
  width: 36px; height: 36px;    /* ô vuông dễ bấm */
  display: grid; place-items: center;
  margin-left: 6px;             /* tách nhẹ khỏi badge Online */
  border-radius: 10px;
margin-bottom: 10px;
  line-height: 1;
}
.tnw-close:hover{ background: rgba(255,255,255,.14); }

/* ===== 2) Hàng nhập tin + nút GỬI: cao bằng nhau, bo góc đều ===== */
.tnw-body{ padding: 12px 12px 8px; }  /* cân mép nội dung */
.tnw-input{
  padding: 12px;                 /* đều bốn phía */
  gap: 10px;
  border-top: 1px solid #eee;
  background: #fff;
}
.tnw-input input,
.tnw-input button{
  height: 46px;                  /* cùng chiều cao */
  border-radius: 12px;           /* bo góc bằng nhau */
}
.tnw-input input{
  padding: 0 14px;               /* text không dính viền */
  border: 1px solid #ddd;
}
.tnw-input button{
  padding: 0 18px;               /* chữ GỬI cân giữa */
  border: 0;
  font-weight: 700;
}

/* ===== 3) Nút tròn nổi (chat / X): căn icon thật giữa, đổ bóng đẹp ===== */
.tnw-bubble{
  width: 56px; height: 56px;
  border-radius: 9999px;
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease;
  margin-bottom: 5px;
}
.tnw-bubble:hover{ transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,0,0,.28); }
.tnw-icon{ position:absolute; inset:0; display:grid; place-items:center; }
.tnw-icon-close{ display:none; font-size: 22px; line-height: 1; } /* X chuẩn tâm */

/* Khi mở hộp thoại: đẩy panel cao lên, đổi icon nút nổi thành X */
.tnw-open .tnw-panel{ bottom: 120px; }
.tnw-open .tnw-icon-chat{ display:none; }
.tnw-open .tnw-icon-close{ display:grid; }
