/* ===== MẠNH LIFE V47: TASK LAYOUT POLISH =====
   Fix theo feedback:
   - Không để cụm thời gian/phút trong task mở rộng bị xuống dòng.
   - Thu gọn 3 chỉ số thời gian thành pill nhỏ, không kéo dài full hàng.
   - Tách tiêu đề nhiệm vụ khỏi checkbox/drag handle, nhìn thoáng hơn.
   - Giữ task card gọn, không nhảy layout khi hover/focus/edit.
*/

/* Card: tăng khoảng cách giữa vùng checkbox và nội dung để tiêu đề không dính checkbox */
.ml-current-task-list .ml-task-item,
.ml-task-list .ml-task-item{
  grid-template-columns:58px minmax(0,1fr) auto!important;
  column-gap:12px!important;
  row-gap:5px!important;
  padding:8px 10px!important;
}
.ml-task-left{
  width:58px!important;
  min-width:58px!important;
  gap:8px!important;
  align-items:flex-start!important;
  justify-content:flex-start!important;
  padding-top:3px!important;
}
.ml-drag-handle{
  width:26px!important;
  height:26px!important;
  min-width:26px!important;
  border-radius:9px!important;
}
.ml-task-check{
  width:19px!important;
  height:19px!important;
  min-width:19px!important;
  margin:3px 0 0!important;
}

/* Tiêu đề: không dính checkbox, không bung khung quá to */
.ml-task-title-row{
  justify-content:flex-start!important;
  align-items:center!important;
  gap:8px!important;
  min-height:24px!important;
  margin:0 0 5px!important;
}
.ml-task-title-row h3,
.ml-inline-edit-title{
  display:inline-flex!important;
  align-items:center!important;
  width:auto!important;
  max-width:min(560px, 100%)!important;
  min-width:0!important;
  padding:1px 6px!important;
  border-radius:8px!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  line-height:1.25!important;
}
.ml-task-title-row h3:hover,
.ml-inline-edit-title:hover{
  background:rgba(248,250,252,.9)!important;
}
.ml-inline-edit-title.ml-title-editing,
.ml-task-title-row h3.ml-title-editing{
  display:inline-block!important;
  width:auto!important;
  max-width:100%!important;
  min-width:150px!important;
  padding:3px 8px!important;
  background:#fff!important;
  border:1px solid #dbe4f0!important;
  outline:2px solid rgba(251,146,60,.16)!important;
  box-shadow:none!important;
  white-space:nowrap!important;
  overflow:hidden!important;
}

/* Meta vẫn gọn, không làm card cao bất thường */
.ml-task-meta-inline{
  display:flex!important;
  align-items:center!important;
  flex-wrap:wrap!important;
  gap:5px!important;
  margin-top:0!important;
}
.ml-task-meta-inline .ml-pill,
.ml-task-meta-inline select.ml-pill,
.ml-task-meta-inline button.ml-pill{
  height:22px!important;
  min-height:22px!important;
  line-height:20px!important;
  padding:0 8px!important;
  font-size:11px!important;
}
.ml-mini-progress{
  height:4px!important;
  margin:5px 0 5px!important;
}

/* Cụm thời gian: một hàng, pill nhỏ, không full-width, không xuống dòng */
.ml-task-item.expanded .ml-task-time-row,
.ml-task-item.running .ml-task-time-row,
.ml-task-time-row,
.ml-task-time-compact{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  flex-wrap:nowrap!important;
  gap:5px!important;
  margin-top:4px!important;
  width:100%!important;
  max-width:100%!important;
  overflow:hidden!important;
}
.ml-task-time-row > div,
.ml-task-time-compact > div{
  flex:0 1 auto!important;
  width:auto!important;
  min-width:102px!important;
  max-width:160px!important;
  height:23px!important;
  min-height:23px!important;
  padding:0 9px!important;
  border-radius:999px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:5px!important;
  background:#f8fafc!important;
  border:1px solid #e5eaf3!important;
  box-shadow:none!important;
  overflow:hidden!important;
}
.ml-task-time-row > div span,
.ml-task-time-compact > div span{
  display:inline!important;
  flex:0 0 auto!important;
  font-size:10px!important;
  color:#94a3b8!important;
  line-height:1!important;
  margin:0!important;
}
.ml-task-time-row > div strong,
.ml-task-time-compact > div strong{
  display:inline!important;
  flex:0 1 auto!important;
  min-width:0!important;
  margin:0!important;
  font-size:12.5px!important;
  line-height:1!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  font-variant-numeric:tabular-nums!important;
}
.ml-task-time-row > div:nth-child(3),
.ml-task-time-compact > div:nth-child(3){
  min-width:120px!important;
  max-width:170px!important;
}

/* Ô phút không được rơi xuống hàng mới; biến thành pill 17p nhỏ */
.ml-task-time-row .ml-inline-min-wrap,
.ml-task-time-compact .ml-inline-min-wrap,
.ml-inline-min-wrap{
  flex:0 0 54px!important;
  width:54px!important;
  min-width:54px!important;
  max-width:54px!important;
  height:23px!important;
  min-height:23px!important;
  padding:0 5px!important;
  border-radius:999px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:1px!important;
  background:#fff7ed!important;
  border:1px solid #fed7aa!important;
  color:#c2410c!important;
  box-shadow:none!important;
  font-size:0!important;
  white-space:nowrap!important;
}
.ml-inline-min-wrap span{display:none!important;}
.ml-inline-minutes{
  width:28px!important;
  min-width:28px!important;
  max-width:28px!important;
  height:18px!important;
  padding:0!important;
  margin:0!important;
  border:0!important;
  background:transparent!important;
  outline:0!important;
  text-align:right!important;
  font-size:11.5px!important;
  font-weight:900!important;
  color:#111827!important;
  line-height:18px!important;
}
.ml-inline-min-wrap::after{
  content:'p';
  display:inline!important;
  font-size:10px!important;
  font-weight:900!important;
  color:#c2410c!important;
  opacity:.78!important;
  margin-left:1px!important;
}

/* Detail zone sát hơn nhưng không đẩy rộng phần trên */
.ml-task-detail-zone{
  margin-top:7px!important;
  padding:7px!important;
  border-radius:12px!important;
}
.ml-inline-subtask-add{
  height:28px!important;
  min-height:28px!important;
}

/* Hover không đổi kích thước */
.ml-task-item,
.ml-task-item:hover,
.ml-task-item.running,
.ml-task-item.expanded{
  transform:none!important;
  transition:border-color .12s ease, background .12s ease, box-shadow .12s ease!important;
}

@media(max-width:900px){
  .ml-current-task-list .ml-task-item,
  .ml-task-list .ml-task-item{
    grid-template-columns:52px minmax(0,1fr)!important;
  }
  .ml-task-left{width:52px!important;min-width:52px!important;}
  .ml-task-actions{grid-column:2!important;justify-content:flex-end!important;}
  .ml-task-time-row,
  .ml-task-time-compact{
    overflow-x:auto!important;
    scrollbar-width:none!important;
  }
  .ml-task-time-row::-webkit-scrollbar,
  .ml-task-time-compact::-webkit-scrollbar{display:none!important;}
  .ml-task-time-row > div,
  .ml-task-time-compact > div{min-width:96px!important;}
}
