body { font-family: 'Inter', sans-serif; font-size: 12px; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f8fafc; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Thu hẹp khoảng cách và chiều cao của các khu vực được khoanh đỏ trên giao diện */

/* 1. Thu hẹp khoảng trống phía trên bảng (thanh tiêu đề trang) */
header.h-10, main header {
	height: 32px !important;
	padding-top: 2px !important;
	padding-bottom: 2px !important;
}

/* 2. Thu hẹp khoảng cách lề trái/phải của lưới bảng dữ liệu */
#table-workspace {
	padding: 0px !important;
}

#table-workspace .bg-white.rounded-lg {
	padding-left: 0px;
	padding-right: 0px;
}

/* 3. Thu hẹp lề bên phải của khu vực bảng hoặc không gian trống dư thừa */
.overflow-x-auto {
	padding-right: 0 !important;
}		

/* Tối ưu không gian bảng dữ liệu compact */
table th{ padding: 6px 10px !important; }	
table td { padding: 6px 10px !important; }		

/* Ẩn hoàn toàn biểu tượng/nút đóng ở góc trên cùng của các Windows-style Modal */
.win-titlebar button.hover\:text-red-600,
.win-titlebar button i.fa-xmark {
	display: none !important;
}		

/* Windows-style Desktop Window Modal */
.win-modal-window {
	box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.15), 0 8px 10px -6px rgb(0 0 0 / 0.15);
	border: 1px solid #cbd5e1;
	border-radius: 6px;
}
.win-titlebar {
	background: linear-gradient(to bottom, #f8fafc, #e2e8f0);
	border-bottom: 1px solid #cbd5e1;
	border-top-left-radius: 5px;
	border-top-right-radius: 5px;
	user-select: none;
}

/* Thu hẹp chiều ngang của menu sidebar xuống còn 220px để tối đa hóa không gian làm việc */
#sidebar {
	width: 220px !important;
	min-width: 220px !important;
}

/* Tối ưu khoảng cách bên trong menu cho gọn gàng hơn */
#menu-container {
	padding-left: 6px;
	padding-right: 6px;
}

#menu-container button {
	padding-left: 8px;
	padding-right: 8px;
	font-size: 11px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#menu-container button:hover {
	background-color: rgba(59, 130, 246, 0.15);
	color: #ffffff;
}
#menu-container button.bg-blue-600 {
	background-color: #2563eb !important;
	color: #ffffff !important;
	font-weight: 600;
}
#sidebar {
	border-right: 1px solid #1e293b;
}
#sidebar .border-slate-800 {
	border-color: #334155 !important;
}

/* Làm gọn các ô input bên trong bảng con hoặc form grid */
table input, table select {
	padding: 3px 6px !important;
	font-size: 11px !important;
	border-radius: 3px !important;
	border-color: #cbd5e1 !important;
}


/* CSS Chuẩn Đồng Bộ & Tối Ưu cho Button dạng Desktop App */
button {
	cursor: pointer;
	user-select: none;
	transition: all 0.1s ease-in-out;
	font-family: 'Inter', sans-serif;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 500;
	padding: 4px 10px;
	border-radius: 4px;
	box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

button:active {
	transform: scale(0.98);
}

/* Các biến thể màu sắc button */
button.bg-blue-600, .btn-primary {
	background-color: #2563eb;
	color: #ffffff;
	border: 1px solid #1d4ed8;
}
button.bg-blue-600:hover, .btn-primary:hover {
	background-color: #1d4ed8;
}

button.bg-slate-800, .btn-dark {
	background-color: #1e293b;
	color: #ffffff;
	border: 1px solid #0f172a;
}
button.bg-slate-800:hover, .btn-dark:hover {
	background-color: #0f172a;
}

button.bg-emerald-600, .btn-success {
	background-color: #059669;
	color: #ffffff;
	border: 1px solid #047857;
}
button.bg-emerald-600:hover, .btn-success:hover {
	background-color: #047857;
}

button.border-slate-300, .btn-default {
	background-color: #ffffff;
	color: #334155;
	border: 1px solid #cbd5e1;
}
button.border-slate-300:hover, .btn-default:hover {
	background-color: #f1f5f9;
	border-color: #94a3b8;
}

/* Nút icon thao tác nhỏ trong bảng */
td button, .action-btn {
	padding: 3px 6px;
	border-radius: 3px;
	box-shadow: none;
	background: transparent;
	border: none;
}
td button:hover {
	background-color: #e2e8f0;
}



/* Ẩn hoàn toàn khung search-card khi không sử dụng để tránh tạo khoảng trống thừa */
#search-card.hidden {
	display: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
}

/* Ép các menu dropdown/subtoolbar ở khu vực toolbar bên phải hiển thị đầy đủ và không bị tràn ra ngoài màn hình */
#toolbar-buttons-wrapper .relative .absolute,
#toolbar-container .relative .absolute {
	right: 0 !important;
	left: auto !important;
	min-width: 240px !important;
	max-width: 380px !important;
	width: max-content !important;
	white-space: nowrap !important;
	z-index: 99999 !important;
	box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.2), 0 8px 10px -6px rgb(0 0 0 / 0.2);
}

/* Định dạng các mục bên trong dropdown để hiển thị trọn vẹn văn bản dài */
#toolbar-buttons-wrapper .relative .absolute button,
#toolbar-buttons-wrapper .relative .absolute a,
#toolbar-container .relative .absolute button,
#toolbar-container .relative .absolute a {
	white-space: nowrap !important;
	text-align: left !important;
	width: 100%;
	display: flex;
	align-items: center;
}

/* Mở rộng chiều rộng khung Autocomplete dựa trên nội dung hoặc thiết lập tối thiểu rộng hơn */
[id*="autocomplete-box"], [id*="selectfromlist-autocomplete-box"], [id*="batch-autocomplete-box"] {
	min-width: 280px !important;
	max-width: 450px !important;
	width: max-content !important;
	white-space: nowrap;
	z-index: 99999 !important;
}

/* Định dạng các dòng item bên trong bảng gợi ý autocomplete để hiển thị đa cột rõ ràng */
[id*="autocomplete-box"] div, [id*="selectfromlist-autocomplete-box"] div, [id*="batch-autocomplete-box"] div {
	padding: 6px 10px;
	font-size: 11px;
	cursor: pointer;
	border-bottom: 1px solid #f1f5f9;
}

[id*="autocomplete-box"] div:hover, [id*="selectfromlist-autocomplete-box"] div:hover, [id*="batch-autocomplete-box"] div:hover {
	background-color: #eff6ff !important;
	color: #1d4ed8;
}	

/* Định kiểu cho mỗi mục trong danh sách autocomplete */
.autocomplete-suggestion {
	padding: 8px 12px;
	cursor: pointer;
	color: #1e293b; /* Màu chữ mặc định */
	font-size: 13px;
	transition: background-color 0.1s ease, color 0.1s ease;
}

/* Tô đậm/đổi màu nền khi rê chuột vào */
.autocomplete-suggestion:hover {
	background-color: #eff6ff !important; /* Màu xanh nhạt */
	color: #1d4ed8 !important; /* Màu xanh đậm */
}

/* Tô đậm/đổi màu nền cho dòng đang được focus bằng bàn phím */
.autocomplete-suggestion.selected-active {
	background-color: #dbeafe !important; /* Màu xanh đậm hơn */
	color: #1e3a8a !important;
	font-weight: 500;
}

/* Đảm bảo danh sách hiển thị đúng và có thể cuộn nếu dài */
.autocomplete-results-container {
	max-height: 300px;
	overflow-y: auto;
	border: 1px solid #cbd5e1;
	border-radius: 0.5rem;
	background-color: #ffffff;
	box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
	z-index: 1000;
}		

/* Ép bảng workspace ẩn hoàn toàn khi có class hidden, vượt qua độ ưu tiên display flex */
#table-workspace.hidden {
	display: none !important;
}

/* Gom lại cấu trúc workspace để bảng dữ liệu mở rộng tối đa khung nhìn */
/* Đảm bảo phần chứa bảng giãn nở phủ kín phần còn lại */
.overflow-x-auto {
	flex: 1;
	max-height: none !important;
	height: auto !important;
}		

#table-workspace {
	display: flex;
	flex-direction: column;
	height: calc(100% - 80px);
	overflow: hidden;
}

#table-workspace .bg-white.rounded-lg {
	display: flex;
	flex-direction: column;
	flex: 1;
	overflow: hidden;
}		


#table-workspace {
	display: flex;
	flex-direction: column;
	height: 100% !important;
	padding: 4px !important;
}		



#table-workspace .bg-white.rounded-lg {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	margin: 0 !important;
}

/* Ép các ô dữ liệu trong bảng không bị xuống dòng */
#sub-data-grid th, #sub-data-grid td {
	text-overflow: ellipsis;
	max-width: 200px;
}


/* Tô sẫm màu rõ ràng cho dòng đang được focus bằng bàn phím */
#sub-data-grid tr.row-keyboard-selected,
#sub-data-grid tr.row-keyboard-selected td {
	background-color: #66FFFF !important; /* Màu xanh sẫm/đậm hơn để dễ nhận biết */
	color: #1e3a8a !important;
	font-weight: 500;
}

/* Đảm bảo khi hover không bị mất màu focus bàn phím */
#sub-data-grid tr.row-keyboard-selected:hover td {
	background-color: #bfdbfe !important;
}

/* Ngoại trừ cột checkbox và cột thao tác cuối cùng */

#sub-data-grid td:first-child, #sub-data-grid th:first-child,
#sub-data-grid td:last-child, #sub-data-grid th:last-child {
	width: 1%;
	white-space: nowrap !important;
}

/* Đảm bảo cột chứa các nút option căn trái */
#sub-data-grid td:last-child, #sub-data-grid th:last-child {
	text-align: left !important;
}		

/* CSS Tối ưu không gian và hiển thị sắc nét cho Bảng dữ liệu (Table) */
#sub-data-grid, #import-preview-grid, #subgrid-name {
	border-collapse: collapse;
	width: 100%;
	font-size: 11px;
	background-color: #ffffff;
}

/* Định nghĩa header của bảng nền màu xanh đen, chữ trắng, giữ nguyên font bình thường và không chuyển thành chữ hoa */
#sub-data-grid th, #import-preview-grid th, subgrid th {
	background-color: #C0C0C0 !important;
	color: #000000 !important;
	font-weight: 500 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	padding: 6px 10px;
	border-bottom: 1px solid #D0D0D0;
	border-right: 1px solid #D0D0D0;
	white-space: nowrap;
}

#sub-data-grid td, #import-preview-grid td {
	padding: 5px 10px;
	border-bottom: 1px solid #e2e8f0;
	border-right: 1px solid #f1f5f9;
	color: #1e293b;
	vertical-align: middle;
}

#sub-data-grid tr:hover, #import-preview-grid tr:hover {
	background-color: #f8fafc;
}



/* Ép các ô dữ liệu trong bảng không bị xuống dòng */
#data-grid th, #data-grid td {
	white-space: nowrap !important;
	text-overflow: ellipsis;
	max-width: 200px;
}


/* Ngoại trừ cột checkbox và cột thao tác cuối cùng */

#data-grid td:first-child, #data-grid th:first-child,
#data-grid td:last-child, #data-grid th:last-child {
	width: 1%;
	white-space: nowrap !important;
}


/* Cố định cột 1 (Checkbox) */
#data-grid th:nth-child(1), #data-grid td:nth-child(1) {
	position: sticky !important;
	left: 0 !important;
	z-index: 29;
	background-color: #F0F0F0;
}

/* Cố định cột 2 (Mã vật tư) */
#data-grid th:nth-child(2), #data-grid td:nth-child(2) {
	position: sticky !important;
	left: 40px !important; 
	z-index: 29;
	background-color: #FFFFF0;
}

/* Cố định cột 3 (Mã vật tư) */
#data-grid th:nth-child(3), #data-grid td:nth-child(3) {
	position: sticky !important;
	left: 130px !important; 
	z-index: 29;
	background-color: #FFFFF0;
}

/* Đồng bộ màu nền khi header cố định cuộn qua lại */
#data-grid th:nth-child(1), #data-grid th:nth-child(2), #data-grid th:nth-child(3) {
	z-index: 29 !important;
	background-color: #C0C0C0 !important;
}


/* Tô sẫm màu rõ ràng cho dòng đang được focus bằng bàn phím */
#data-grid tr.row-keyboard-selected,
#data-grid tr.row-keyboard-selected td {
	background-color: #66FFFF !important; /* Màu xanh sẫm/đậm hơn để dễ nhận biết */
	color: #1e3a8a !important;
	font-weight: 500;
}

/* Đảm bảo khi hover không bị mất màu focus bàn phím */
#data-grid tr.row-keyboard-selected:hover td {
	background-color: #bfdbfe !important;
}		




/* CSS Căn trái cho các nút/menu thao tác (action) tương ứng với mỗi bản ghi trên lưới dữ liệu */
td .flex.items-center, 
td div[class*="flex"],
.row-options-container,
td.text-right, td.text-center {
	text-align: left !important;
	justify-content: flex-start !important;
}

/* Đảm bảo cột chứa các nút option căn trái */
#data-grid td:last-child, #data-grid th:last-child {
	text-align: left !important;
}		

/* CSS Tối ưu không gian và hiển thị sắc nét cho Bảng dữ liệu (Table) */
#data-grid, #import-preview-grid, #subgrid-name {
	border-collapse: collapse;
	width: 100%;
	font-size: 11px;
	background-color: #ffffff;
}

/* Định nghĩa header của bảng nền màu xanh đen, chữ trắng, giữ nguyên font bình thường và không chuyển thành chữ hoa */
#data-grid th, #import-preview-grid th, subgrid th {
	background-color: #C0C0C0 !important;
	color: #000000 !important;
	font-weight: 500 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	padding: 6px 10px;
	border-bottom: 1px solid #D0D0D0;
	border-right: 1px solid #D0D0D0;
	white-space: nowrap;
}

#data-grid td, #import-preview-grid td {
	padding: 2px 2px;
	border-bottom: 1px solid #e2e8f0;
	border-right: 1px solid #f1f5f9;
	color: #1e293b;
	vertical-align: middle;
}

#data-grid tr:hover, #import-preview-grid tr:hover {
	background-color: #f8fafc;
}

.modal-alway-ontop{
	z-index: 99999 !important;
}		

/* Định nghĩa các lớp độ rộng tùy chỉnh cho modal */
.modal-width-sm { width: 500px !important; max-width: 90vw !important; }
.modal-width-md { width: 750px !important; max-width: 90vw !important; }
.modal-width-lg { width: 1000px !important; max-width: 95vw !important; }
.modal-width-xl { width: 92vw !important; max-width: 1400px !important; } /* Gần như toàn màn hình */
.modal-width-full { width: 100vw !important; height: 100vh !important; border-radius: 0 !important; }		


